FORUMS: list search recent posts

ffmpeg to set metadata

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Peter Robertson
ffmpeg to set metadata
on Feb 12, 2013 at 10:00:04 pm

I use ffmpeg to set metadata on some of my video clips during conversion. Is there a way to set the metadata of a video without sending it to an output. Occasionally I don't want to convert a clip but just change the metadata. I know there are probably other apps out there that will allow you to write video metadata but I'd like to use ffmpeg if possible.

Perhaps there is a way to make a DUPLICATE of a clip and write the metadata to the duplicate clip?

Thanks.

Pedro

Pedro


Return to posts index

Reuben Martin
Re: ffmpeg to set metadata
on Feb 13, 2013 at 12:09:49 am

This entirely depends on what format you are trying to change the metadata on.


Return to posts index

Jim Sustacek
Re: ffmpeg to set metadata
on Feb 13, 2013 at 1:36:04 pm

I don't think you can do it -- I've never seen ffmpeg update/write a file in-place.

I often use MP4Box (and mp4track) for metadata updates instead.

Otherwise, for ffmpeg, I always use two commands: the first to write to a temp file, then the second to copy it back to the original:
ffmpeg -i original.mp4 -metadata title="my title" -c copy -y /tmp/tmp.mp4 && ffmpeg -i /tmp/tmp.mp4 -c copy -y original.mp4
If you do it a lot, you could wrap it all in a nice script too.


Return to posts index


Lou Logan
Re: ffmpeg to set metadata
on Feb 13, 2013 at 9:08:25 pm

[Jim Sustacek] "ffmpeg -i original.mp4 -metadata title="my title" -c copy -y /tmp/tmp.mp4 && ffmpeg -i /tmp/tmp.mp4 -c copy -y original.mp4"

Consider adding "-map 0". By default ffmpeg will choose to copy only the "best" streams but not automatically choose all streams when using "-c copy". From the documentation:


Stream selection
By default ffmpeg includes only one stream of each type (video, audio, subtitle) present in the input files and adds them to each output file. It picks the "best" of each based upon the following criteria; for video it is the stream with the highest resolution, for audio the stream with the most channels, for subtitle it’s the first subtitle stream. In the case where several streams of the same type rate equally, the lowest numbered stream is chosen.


This doesn't matter for an input that only has one stream per stream type (video, audio, subtitle, etc), but adding "-map 0" will ensure that all streams from the (first) input will be copied if your input contains multiple tracks per stream type (such as one video stream and two audio streams).


Return to posts index

Jim Sustacek
Re: ffmpeg to set metadata
on Feb 14, 2013 at 8:21:50 pm

Thanks for the "-map 0" tip, I will keep that in mind!


Return to posts index

Peter Robertson
Re: ffmpeg to set metadata
on Feb 20, 2013 at 6:43:15 pm

That works great except I can't seem to be able to set the description

-metadata description="Some info"

Either that or I can't seem to be able to view it using Exiftool.

Any suggestions?

Thanks.

Pedro


Return to posts index


Lou Logan
Re: ffmpeg to set metadata
on Feb 21, 2013 at 7:52:14 pm

[Peter Robertson] "Any suggestions?"

Please show your full ffmpeg command and the complete console output.


Return to posts index

Peter Robertson
Re: ffmpeg to set metadata
on Feb 26, 2013 at 3:47:40 pm

These are the commands that I am using:

ffmpeg -i MTStest.mp4 -metadata title="66115-title of clip" -metadata author="authors name" -metadata description="some description" -c copy -y /tmp/tmp.mov && ffmpeg -i /tmp/tmp.mov -c copy -y MTStest.mp4


And this is the output from the command line:

ffmpeg version N-49695-g4e2c636 Copyright (c) 2000-2013 the FFmpeg developers
built on Feb 7 2013 13:15:40 with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
configuration: --enable-libx264 --enable-gpl --enable-shared
libavutil 52. 17.101 / 52. 17.101
libavcodec 54. 91.102 / 54. 91.102
libavformat 54. 61.104 / 54. 61.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 35.101 / 3. 35.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MTStest.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : 66115-title of clip
artist : authors name
encoder : Lavf54.61.104
copyright : Peter Robertson
Duration: 00:28:38.76, start: 0.000000, bitrate: 1150 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1013 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
handler_name : SoundHandler
Output #0, mov, to '/tmp/tmp.mov':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
copyright : Peter Robertson
artist : authors name
description : some description
title : 66115-title of clip
author : authors name
encoder : Lavf54.61.104
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1013 kb/s, 29.97 fps, 30k tbn, 30k tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, 128 kb/s
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 9236 fps=0.0 q=-1.0 size= 42138kB time=00:05:08.09 bitrate=1120.4kbits/frame=18903 fps=18440 q=-1.0 size= 90115kB time=00:10:30.65 bitrate=1170.6kbitframe=26939 fps=17348 q=-1.0 size= 131077kB time=00:14:58.81 bitrate=1194.7kbitframe=37062 fps=18054 q=-1.0 size= 176522kB time=00:20:36.58 bitrate=1169.4kbitframe=47064 fps=18436 q=-1.0 size= 220154kB time=00:26:10.32 bitrate=1148.5kbitframe=51510 fps=18353 q=-1.0 Lsize= 241301kB time=00:28:38.74 bitrate=1150.1kbits/s
video:212533kB audio:26920kB subtitle:0 global headers:0kB muxing overhead 0.771552%
ffmpeg version N-49695-g4e2c636 Copyright (c) 2000-2013 the FFmpeg developers
built on Feb 7 2013 13:15:40 with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
configuration: --enable-libx264 --enable-gpl --enable-shared
libavutil 52. 17.101 / 52. 17.101
libavcodec 54. 91.102 / 54. 91.102
libavformat 54. 61.104 / 54. 61.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 35.101 / 3. 35.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/tmp.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
title : 66115-title of clip
artist : authors name
encoder : Lavf54.61.104
copyright : Peter Robertson
Duration: 00:28:38.76, start: 0.000000, bitrate: 1150 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1013 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
Metadata:
handler_name : DataHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
handler_name : DataHandler
Output #0, mp4, to 'MTStest.mp4':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
title : 66115-title of clip
artist : authors name
copyright : Peter Robertson
encoder : Lavf54.61.104
Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1013 kb/s, 29.97 fps, 30k tbn, 30k tbc
Metadata:
handler_name : DataHandler
Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 128 kb/s
Metadata:
handler_name : DataHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=10163 fps=0.0 q=-1.0 size= 46411kB time=00:05:39.05 bitrate=1121.4kbits/frame=18903 fps=18860 q=-1.0 size= 90115kB time=00:10:30.65 bitrate=1170.6kbitframe=28765 fps=18706 q=-1.0 size= 139265kB time=00:15:59.76 bitrate=1188.7kbitframe=39383 fps=19327 q=-1.0 size= 186811kB time=00:21:54.02 bitrate=1164.6kbitframe=48629 fps=19162 q=-1.0 size= 226937kB time=00:27:02.54 bitrate=1145.8kbitframe=51510 fps=19060 q=-1.0 Lsize= 241301kB time=00:28:38.74 bitrate=1150.1kbits/s
video:212533kB audio:26920kB subtitle:0 global headers:0kB muxing overhead 0.771520%


The "description : some description" is not being written to the file. The others are.

Thanks.

Peter

Pedro


Return to posts index

Lou Logan
Re: ffmpeg to set metadata
on Feb 26, 2013 at 7:33:46 pm

ffmpeg does not seem to support description for mov container, but it seems to work fine with mp4 container. I'm not sure if this is supported officially by mov or if it is simply a missing feature in ffmpeg. Why are you using mov as the output container and then re-muxing to mp4? Why not simply output to mp4?

Also, placing your commands and console output in the CODE tags will make it easier to read and differentiate it from your comments.


Return to posts index


Peter Robertson
Re: ffmpeg to set metadata
on Feb 26, 2013 at 9:01:46 pm

THANKS! I feel a little silly--I did not realize I forgot to change the extension of the tmp file from .mov to .mp4.

Pedro


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]