Opened 10 years ago

Closed 10 years ago

#3753 closed defect (fixed)

'-timecode' & '-metadata' not working: not creating a stream (tmcd) in output MOV

Reported by: AgentJJ24 Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mov timecode metadata
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: I'm trying to use FFMPEG to update Timecode and "reel_name" metadata in an MOV. I'm attempting to just create a new timecode and reelname metadata tag in the tmcd stream of an Output mov. It is not working. The stream entirely disappears in the Output mov. I tried just copying and altering, however, the stream isn't even copied from the Input. I have tried copying with "-map 0 -c:d copy" and that'll copy the stream into the output file, but then I cannot change the metadata (timecode and reel_name).
How to reproduce:

% ffmpeg -i ./INPUT.mov -vcodec copy -acodec copy -timecode 01:02:03:04 -metadata reel_name=ABCD1234 ./OUTPUT.mov
ffmpeg version 2.2.4-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2000-2014 the FFmpeg developers
  built on Jul  1 2014 22:10:48 with gcc 4.8 (Debian 4.8.3-4)
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --disable-ffserver --enable-libass --enable-gnutls --cc=gcc-4.8
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './INPUT.mov':
  Metadata:
    creation_time   : 2014-06-29 03:18:04
  Duration: 00:00:47.42, start: 0.000000, bitrate: 664 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 854x480, 658 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
    Metadata:
      creation_time   : 2014-06-29 03:18:04
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2014-06-29 03:18:27
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
Output #0, mov, to './OUTPUT.mov':
  Metadata:
    timecode        : 01:02:03:04
    reel_name       : ABCD1234
    encoder         : Lavf55.33.100
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 854x480, q=2-31, 658 kb/s, 23.98 fps, 24k tbn, 24k tbc (default)
    Metadata:
      creation_time   : 2014-06-29 03:18:04
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 1137 fps=0.0 q=-1.0 Lsize=    3824kB time=00:00:47.33 bitrate= 661.8kbits/s    
video:3811kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.361878%

As you can see, the second stream[Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)] is not created in the output at all. The metadata and timecode info MUST be in the tmcd stream, but it just keeps falling into the global metadata.

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

INPUT.mov (427.2 KB ) - added by AgentJJ24 10 years ago.
Here is the example INPUT.mov used in the ticket's description

Download all attachments as: .zip

Change History (9)

comment:1 by Carl Eugen Hoyos, 10 years ago

Component: ffmpegundetermined

Is the problem you see reproducible with current FFmpeg git head?
Do you think this is a regression (regressions are the main reason why tickets are important)?

in reply to:  1 comment:2 by AgentJJ24, 10 years ago

Replying to cehoyos:

Is the problem you see reproducible with current FFmpeg git head?

Yes. Here is the output:

ffmpeg -i ./INPUT.mov -vcodec copy -acodec copy -timecode 01:02:03:04 -metadata reel_name=ABCD1234 ./OUTPUT.mov
ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers
  built on Jul  1 2014 18:11:18 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --prefix=/home/captain/FFMPEG/ffmpeg_build --extra-cflags=-I/home/captain/FFMPEG/ffmpeg_build/include --extra-ldflags=-L/home/captain/FFMPEG/ffmpeg_build/lib --bindir=/home/captain/FFMPEG/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      52. 90.101 / 52. 90.101
  libavcodec     55. 68.100 / 55. 68.100
  libavformat    55. 44.100 / 55. 44.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  9.100 /  4.  9.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './INPUT.mov':
  Metadata:
    creation_time   : 2014-06-29 03:18:04
  Duration: 00:00:47.42, start: 0.000000, bitrate: 664 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 854x480, 658 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
    Metadata:
      creation_time   : 2014-06-29 03:18:04
      handler_name    : Apple Alias Data Handler
      encoder         : H.264
      timecode        : 00:00:00:00
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2014-06-29 03:18:27
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
[mov @ 0x22155e0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
Output #0, mov, to './OUTPUT.mov':
  Metadata:
    timecode        : 01:02:03:04
    reel_name       : ABCD1234
    encoder         : Lavf55.44.100
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 854x480, q=2-31, 658 kb/s, 23.98 fps, 24k tbn, 24k tbc (default)
    Metadata:
      creation_time   : 2014-06-29 03:18:04
      handler_name    : Apple Alias Data Handler
      encoder         : H.264
      timecode        : 00:00:00:00
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 1137 fps=0.0 q=-1.0 Lsize=    3824kB time=00:00:47.33 bitrate= 661.8kbits/s    
video:3811kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.361878%

Do you think this is a regression (regressions are the main reason why tickets are important)?

Yes, because this is suppose to be a very regular part of film postproduction workflows that have utilized it with no trouble in the past.

The Output should have the #0.1 Stream (tmcd stream) that should have the changed metadata (timecode and reel_name).

I've included the sample "INPUT.mov" that I've tested this on.
Thank you!

Last edited 10 years ago by AgentJJ24 (previous) (diff)

by AgentJJ24, 10 years ago

Attachment: INPUT.mov added

Here is the example INPUT.mov used in the ticket's description

comment:3 by Carl Eugen Hoyos, 10 years ago

Priority: importantnormal
Version: 2.2.4git-master

comment:4 by Timothy Gu, 10 years ago

I don't think ffmpeg supports muxing arbitrary metadata keys like reel_name (but I might be wrong). For timecode, can you try -metadata timecode=01:02:03:04?

in reply to:  4 comment:5 by AgentJJ24, 10 years ago

Replying to Timothy_Gu:

I don't think ffmpeg supports muxing arbitrary metadata keys like reel_name (but I might be wrong). For timecode, can you try -metadata timecode=01:02:03:04?

It'll show it in the Output, but it doesn't seem to "stick." It doesn't appear with ffprobe nor is it anywhere in the binary (I've gone so far as to check the QT atoms in a hex editor).

It seems that ffmpeg just doesn't want to write out the stream.

Here's an example:

 ffmpeg -i ./INPUT.mov -map_metadata:s:1 0:s:1  -map 0 -c:v copy -c:d copy -metadata:s:1 timecode="01:02:03:04" -metadata:s:1 reel_name=ABCD1234 -y ./OUTPUT.mov
ffmpeg version 2.2.4-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2000-2014 the FFmpeg developers
  built on Jul  1 2014 22:10:48 with gcc 4.8 (Debian 4.8.3-4)
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --disable-ffserver --enable-libass --enable-gnutls --cc=gcc-4.8
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './INPUT.mov':
  Metadata:
    creation_time   : 2014-06-29 03:18:04
  Duration: 00:00:47.42, start: 0.000000, bitrate: 664 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 854x480, 658 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
    Metadata:
      creation_time   : 2014-06-29 03:18:04
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2014-06-29 03:18:27
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
Output #0, mov, to './OUTPUT.mov':
  Metadata:
    encoder         : Lavf55.33.100
    Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p, 854x480, q=2-31, 658 kb/s, 23.98 fps, 24k tbn, 24k tbc (default)
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2014-06-29 03:18:27
      handler_name    : Apple Alias Data Handler
      timecode        : 01:02:03:04
      reel_name       : ABCD1234
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1137 fps=0.0 q=-1.0 Lsize=    3824kB time=00:00:47.33 bitrate= 661.8kbits/s    
video:3811kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.362185%

It LOOKS like it would be PERFECT. However, when I probe it:

ffprobe OUTPUT.mov
ffprobe version 0.7-rc8
Copyright (c) 2007-2013 Baptiste Coudurier and the FFmpeg developers
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'OUTPUT.mov':
  Metadata:
    major_brand: qt  
    minor_version: 512
    compatible_brands: qt  
    encoder: Lavf55.33.100
    timecode: 00:00:00:00
  Duration: 13:10:22.37, bitrate: 0 kb/s
    Stream #0.0(eng): Video: h264 (Main), yuv420p, 854x480p, 658 kb/s, 23.98 fps
    Stream #0.1(eng): Data: unknown (tmcd)
Unsupported codec with id 0 for input stream 1

Or '-show_streams':

 ffprobe -show_streams OUTPUT.mov
ffprobe version 0.7-rc8
Copyright (c) 2007-2013 Baptiste Coudurier and the FFmpeg developers
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'OUTPUT.mov':
  Metadata:
    major_brand: qt  
    minor_version: 512
    compatible_brands: qt  
    encoder: Lavf55.33.100
    timecode: 00:00:00:00
  Duration: 13:10:22.37, bitrate: 0 kb/s
    Stream #0.0(eng): Video: h264 (Main), yuv420p, 854x480p, 658 kb/s, 23.98 fps
    Stream #0.1(eng): Data: unknown (tmcd)
Unsupported codec with id 0 for input stream 1
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
codec_type=video
codec_time_base=0/1
codec_tag_string=avc1
codec_tag=0x31637661
width=854
height=480
has_b_frames=0
pix_fmt=yuv420p
level=30
progressive
r_frame_rate=24000/1001
avg_frame_rate=1705500/71071
time_base=1/24000
start_time=0.000000 
duration=47.380667 
nb_frames=1137
TAG:language=eng
[/STREAM]
[STREAM]
index=1
codec_name=unknown
codec_type=data
codec_time_base=1/24
codec_tag_string=tmcd
codec_tag=0x64636d74
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/24
start_time=0.000000 
duration=47422.375000 
nb_frames=1
TAG:language=eng
[/STREAM]

It just seems like the changes don't "stick"

Last edited 10 years ago by AgentJJ24 (previous) (diff)

comment:6 by AgentJJ24, 10 years ago

Here's the kicker: ffprobe of the INPUT shows that the TAG "reel_name" in the tmcd Data Stream is very much a part of the QT mov (this TAG is used by video editing software)

ffprobe -show_streams INPUT.mov
ffprobe version 0.7-rc8
Copyright (c) 2007-2013 Baptiste Coudurier and the FFmpeg developers
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'INPUT.mov':
  Metadata:
    timecode: 00:00:00:00
  Duration: 00:00:47.42, bitrate: 664 kb/s
    Stream #0.0(eng): Video: h264 (Main), yuv420p, 854x480p, 658 kb/s, 23.98 fps
    Metadata:
      codec_name: H.264
    Stream #0.1(eng): Data: unknown (tmcd)
    Metadata:
      reel_name(eng): OFFLINE_FILES
Unsupported codec with id 0 for input stream 1
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
codec_type=video
codec_time_base=0/1
codec_tag_string=avc1
codec_tag=0x31637661
width=854
height=480
has_b_frames=0
pix_fmt=yuv420p
level=30
progressive
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=1/24000
start_time=0.000000 
duration=47.422375 
nb_frames=1137
TAG:language=eng
TAG:codec_name=H.264
[/STREAM]
[STREAM]
index=1
codec_name=unknown
codec_type=data
codec_time_base=1/24
codec_tag_string=tmcd
codec_tag=0x64636d74
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/24000
start_time=0.000000 
duration=47.422375 
nb_frames=1
TAG:language=eng
TAG:reel_name=OFFLINE_FILES
[/STREAM]

Here is another probe of a working file:

ffprobe -show_streams WORKINGexample.mov
ffprobe version 0.7-rc8
Copyright (c) 2007-2013 Baptiste Coudurier and the FFmpeg developers
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'WORKINGexample.mov':
  Metadata:
    major_brand: qt  
    minor_version: 0
    compatible_brands: qt  
    encoder: FFmbc 0.7
    timecode: 02:03:04:05
  Duration: 00:00:47.42, bitrate: 12104 kb/s
    Stream #0.0(eng): Video: prores, yuv422p10le, 854x480p, 12102 kb/s, 23.98 fps
    Metadata:
      codec_name: prores
    Stream #0.1(eng): Data: unknown (tmcd)
    Metadata:
      reel_name(eng): EF02
Unsupported codec with id 0 for input stream 1
[STREAM]
index=0
codec_name=prores
codec_long_name=ProRes
codec_type=video
codec_time_base=0/1
codec_tag_string=apco
codec_tag=0x6f637061
width=854
height=480
has_b_frames=0
pix_fmt=yuv422p10le
level=-99
progressive
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=1/24000
start_time=0.000000 
duration=47.422375 
nb_frames=1137
TAG:language=eng
TAG:codec_name=prores
[/STREAM]
[STREAM]
index=1
codec_name=unknown
codec_type=data
codec_time_base=1/24
codec_tag_string=tmcd
codec_tag=0x64636d74
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/24000
start_time=0.000000 
duration=47.422375 
nb_frames=1
TAG:language=eng
TAG:reel_name=EF02
[/STREAM]

comment:7 by Mark Reid, 10 years ago

I recently submitted patches that add support for this. If you compile the latest git master it should work. Currently, you must specify the stream you want add the reel_name metadata too. try:

ffmpeg -i ./INPUT.mov -vcodec copy -acodec copy -timecode 01:02:03:04 -metadata:s:v:0 reel_name=ABCD1234 ./OUTPUT.mov
ffprobe ./OUTPUT.mov 
ffprobe version N-65494-g93a4891 Copyright (c) 2007-2014 the FFmpeg developers
  built on Aug 10 2014 14:58:55 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  configuration: --samples=fate-suite/
  libavutil      54.  1.100 / 54.  1.100
  libavcodec     56.  0.100 / 56.  0.100
  libavformat    56.  0.100 / 56.  0.100
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  0.100 /  5.  0.100
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  0.100 /  1.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'OUTPUT.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf56.0.100
  Duration: 00:00:03.75, start: 0.000000, bitrate: 919 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 854x480, 914 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : H.264
      timecode        : 00:00:00:00
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
    Metadata:
      handler_name    : DataHandler
      reel_name       : ABCD1234
      timecode        : 00:00:00:00
Version 0, edited 10 years ago by Mark Reid (next)

comment:8 by Carl Eugen Hoyos, 10 years ago

Component: undeterminedavformat
Keywords: mov, timecode, metadata → mov timecode metadata
Resolution: fixed
Status: newclosed

Fixed in d6af706e

Note: See TracTickets for help on using tickets.