2

I was looking for saving custom data into movie file using ffmpeg mainly actual start frame, end frame, and other few information something like key:value pair, so later on I can fetch the details from movie file on the go.

I looked all over but couldn't figure out myself. Is there anyway to do that?

Nathan.Eilisha Shiraini
  • 2,633
  • 1
  • 14
  • 24
Mahendra
  • 133
  • 1
  • 5

2 Answers2

6

You don't mention which container format you want this facility for, since some don't allow custom tags.

FFmpeg's Matroska muxer allows random tags, so

ffmpeg -i input -c copy
       -metadata key1=value1
       -metadata:s:v key2=value2
       -metadata:s:a:0 key3=value3
out.mkv

The first metadata options set a global value, the 2nd is applied to all video streams, and the third to the 1st audio stream only.

Mediainfo and ffprobe can show these values.

Gyan
  • 34,439
  • 6
  • 56
  • 98
  • Thanks @Mulvya, it worked like charm!! I have to push some data into .mov, .qt files for now, and looks like as you mentioned, its not adding any data into .mov files, I can clearly see my custom data in .mkv file though, is there any way to add this into .mov or .qt files? – Mahendra Jul 18 '16 at 14:07
  • Can we add multiple metadata tag (-metadata:s:v key2=value2) for video like how can I pass coma separated or I need to write multiple commands for same, is there any way to do this? https://stackoverflow.com/questions/54248390/add-multiple-metadata-in-video-using-ffmpeg-command – Raghbendra Nayak Jan 18 '19 at 05:58
1

got it.. after doing some digging on same line -metadata found this amazing post - https://jmesb.com/how_to/create_id3_tags_using_ffmpeg this will do any format I believe.

ffmpeg supports few tags which can be manipulated like title, comments, artists, album, track

ffmpeg32 -i out.mov-metadata publisher="Publishers Info" -metadata artist="my metadata" -metadata album="another data" -metadata TIT3="more data" out2.mov

this way I could able to add custom data into metadata, though TIT3 is for subtitles, we at work never use it, so I could able to hack through this attribute.

Mahendra
  • 133
  • 1
  • 5
  • Please include at least a *summary* of that content here. Posts which contain [merely a link and nothing else](http://meta.stackexchange.com/q/225370/147191) are likely to be deleted. – TRiG Jul 18 '16 at 14:41
  • That's only for MP3s or for formats that support ID3 tags. – Gyan Jul 18 '16 at 15:11
  • it supports .mov as well, I think by using existing attribute I could able to save custom data for formats like .mov and .qt – Mahendra Jul 18 '16 at 15:34