LiveStreamRecorderMP4 and MP4 metadata?

Is there a way to write additional metadata fields to the header of the .mp4 file produced? I’d like to set the episode-id (TVEN) atom when recording.

Thanks,

Jeremy

Hi, Jeremy,

This method to inject metadata in the live stream should work. The metadata should record.

Richard

Jeremy,

I’ve been testing this and also do not find metadata injected into the live stream in the recording of the live stream. I will have to get back to you.

Richard

Okay, so I have the following in my streaming module after recorder.startRecording(stream, outputFile, false):

		// attempt to inject an episode ID
		AMFDataList amfList = new AMFDataList();
		
		amfList.add(new AMFDataItem("@setDataFrame"));
		amfList.add(new AMFDataItem("onMetaData"));
		
		AMFDataMixedArray metaData = new AMFDataMixedArray();
		
		metaData.put("tven", new AMFDataItem("XX test episode ID"));
		metaData.put("param2", new AMFDataItem("data2"));
		amfList.add(metaData);
				
		synchronized(stream)
	    {
			byte[] dataData = amfList.serialize();
			int size = dataData.length;
            long timecode = Math.max(stream.getAudioTC(), stream.getVideoTC());
            stream.setDataTC(timecode);
            stream.setDataSize(size);
            stream.startDataPacket();
            stream.addDataData(dataData, 0, size);
	    }		

However, the resulting .mp4 file doesn’t contain any additional data, as reported by ffmpeg:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'c:\temp\Exam1 2014-02-24 09.35.56.mp4':
  Metadata:
    major_brand     : f4v
    minor_version   : 0
    compatible_brands: isommp42m4v
    creation_time   : 2014-02-24 14:35:56
  Duration: 00:13:57.92, start: 0.000000, bitrate: 5283 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1920x
1080 [SAR 1:1 DAR 16:9], 5149 kb/s, 60 fps, 60 tbr, 90k tbn, 120 tbc
    Metadata:
      creation_time   : 2014-02-24 14:35:56
      handler_name    : WowzaMediaServerPro
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 12
5 kb/s
    Metadata:
      creation_time   : 2014-02-24 14:35:56
      handler_name    : WowzaMediaServerPro

How can I inject metadata that will be written to the mp4 file?

Edit: also checked with a hex editor, and the strings written out don’t appear anywhere in the mp4 file, so it’s not just a matter of ffmpeg not reading them.

Hi,

are there any news on that? I guess I have the same problem.

Current Setup:

Streaming webcam from FlashPlayer (web) to Wowza-server and recording it there.

Generating Metadata (title / description) via FlashPlayer / Netstream.Send

I verified that the metadata is delivered to and recognized by Wowza-Server:

byte[] data = metaDataPacket.getData();
AMFDataList metaDataList = new AMFDataList(data);
logger.info("StreamListener '" + stream.getName() + "' | onMetaData: "+metaDataList.toString());
INFO server comment - StreamListener 'video-1409042059-1785536785' | onMetaData: 
{Obj[]: description: "Eine Beschreibung", caption: "Test-Caption", title: "Ein Titel"}

Also, when I use FLV instead of H264-Encoding in Flash, i get the metadata perfectly recorded.

But this is no option since FLV is poor quality with big file sizes.

I did not try different H264-Settings in Flash.

But this seems no problem since the metadata is passed to the server and can be decoded there.

Here are my H264-Settings if they do matter:

ActionScript:

var h264Settings:H264VideoStreamSettings = new H264VideoStreamSettings();
h264Settings.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL_3);
netStream.videoStreamSettings = h264Settings;

thanks for reading.