Opened 11 years ago

Closed 11 years ago

#2892 closed defect (fixed)

Setting mov timecode fails when remuxing mpegvideo because of high tbc value

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

Description

A longstanding bug in determining the tbn value for an mpeg source now prevents adding timecode to imx MOV format
How to reproduce:

% ffmpeg.exe -i test.mov -c:v copy -c:a copy -vtag mx3n -timecode 10:00:00:00 out.mov
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 28 2013 00:28:48 with gcc 4.8.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libo
pencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li
bschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib
twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enabl
e-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    creation_time   : 1970-01-01 00:00:00
  Duration: 00:00:30.03, start: 0.000000, bitrate: 32315 kb/s
    Stream #0:0(eng): Video: mpeg2video (4:2:2) (mx3n / 0x6E33786D), yuv422p, 72
0x512 [SAR 128:135 DAR 4:3], 30006 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:10;00
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32, 2304 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : Apple Alias Data Handler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
    Metadata:
      creation_time   : 2013-02-07 15:58:36
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:10;00
Output #0, mov, to 'out.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    timecode        : 10:00:00:00
    encoder         : Lavf54.63.104
    Stream #0:0(eng): Video: mpeg2video (mx3n / 0x6E33786D), yuv422p, 720x512 [S
AR 128:135 DAR 4:3], q=2-31, 30006 kb/s, 29.97 fps, 30k tbn, 30k tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:10;00
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, 23
04 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : Apple Alias Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  626 fps=0.0 q=-1.0 size=   78835kB time=00:00:20.85 bitrate=30968.0kbits
fps 30000 is too large
frame=  900 fps=0.0 q=-1.0 Lsize=  118466kB time=00:00:30.03 bitrate=32316.7kbits/s
video:109998kB audio:8446kB subtitle:0 global headers:0kB muxing overhead 0.018463%
ffmpeg version
built on ...

Thanks in advance

m

Change History (11)

comment:1 by Carl Eugen Hoyos, 11 years ago

Please test current git head and please provide the input sample.

in reply to:  1 comment:2 by Michael Orton, 11 years ago

Replying to cehoyos:

Please test current git head and please provide the input sample.

Thanks, here below:

ffmpeg.exe -i test.mov -c:v copy -c:a copy -vtag mx3n -timecode 10:00:00:00 out.mov
ffmpeg version N-55721-gc443689 Copyright (c) 2000-2013 the FFmpeg developers

built on Aug 22 2013 18:59:54 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av

isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
enable-libxvid --enable-zlib

libavutil 52. 42.100 / 52. 42.100
libavcodec 55. 29.100 / 55. 29.100
libavformat 55. 14.102 / 55. 14.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 82.102 / 3. 82.102
libswscale 2. 5.100 / 2. 5.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100

Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mov':

Metadata:

major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 1970-01-01 00:00:00

Duration: 00:00:30.03, start: 0.000000, bitrate: 32315 kb/s

Stream #0:0(eng): Video: mpeg2video (4:2:2) (mx3n / 0x6E33786D), yuv422p, 72

0x512 [SAR 128:135 DAR 4:3], 30006 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc

Metadata:

creation_time : 1970-01-01 00:00:00
handler_name : Apple Alias Data Handler
timecode : 00:00:07;00

Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32, 2304 kb/s
Metadata:

creation_time : 1970-01-01 00:00:00
handler_name : Apple Alias Data Handler

Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:

creation_time : 2013-02-07 15:40:51
handler_name : Apple Alias Data Handler
timecode : 00:00:07;00

Output #0, mov, to 'out.mov':

Metadata:

major_brand : qt
minor_version : 512
compatible_brands: qt
timecode : 10:00:00:00
encoder : Lavf55.14.102
Stream #0:0(eng): Video: mpeg2video (mx3n / 0x6E33786D), yuv422p, 720x512 [SAR 128:135 DAR 4:3], q=2-31, 30006 kb/s, 29.97 fps, 30k tbn, 30k tbc
Metadata:

creation_time : 1970-01-01 00:00:00
handler_name : Apple Alias Data Handler
timecode : 00:00:07;00

Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, 2304 kb/s
Metadata:

creation_time : 1970-01-01 00:00:00
handler_name : Apple Alias Data Handler

Stream mapping:

Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)

Press [q] to stop, ? for help
frame= 660 fps=0.0 q=-1.0 size= 84363kB time=00:00:21.98 bitrate=31430.0kbits
fps 30000 is too large
frame= 900 fps=0.0 q=-1.0 Lsize= 118466kB time=00:00:30.03 bitrate=32316.6kbits/s
video:109998kB audio:8446kB subtitle:0 global headers:0kB muxing overhead 0.018463%

Version 0, edited 11 years ago by Michael Orton (next)

comment:3 by Carl Eugen Hoyos, 11 years ago

See http://ffmpeg.org/bugreports.html (there is no hard size limit).

comment:4 by Michael Orton, 11 years ago

Uploaded file MPEG_tbn_test.mov and explanatory MPEG_tbn_test.rtf @ 15:30 PST

comment:5 by Carl Eugen Hoyos, 11 years ago

Summary: MPEG tbn value incorrectly evaluated: causes MOV wrap to failMPEG tbn value incorrectly evaluated: causes MOV remuxing to fail

Could you elaborate why you think that remuxing fails? It succeeds here (as in your examples above).

Please do not use "to wrap" for "muxing": Wrapping in combination with MPEG streams usually has another meaning (timestamp wraps) and made understanding your original report very difficult.

comment:6 by Carl Eugen Hoyos, 11 years ago

Keywords: mov mpegps added
Summary: MPEG tbn value incorrectly evaluated: causes MOV remuxing to failSetting mov timecode fails when remuxing from mpegps because of high tbc value
Version: unspecifiedgit-master

comment:7 by Carl Eugen Hoyos, 11 years ago

Could you test if the following command works as expected?
$ ffmpeg -i MPEG_tbn_test.mov -c:v copy -c:a copy -vtag mx3n -timecode 10:00:00:00 -r 30 out.mov

comment:8 by Michael Orton, 11 years ago

Yes, using either -r 30 or -r 29.97 allows the muxing to proceed to completion. Have also checked PAL IMX (-vtag mx3p -r 25) and the -r switch also works there as well.

tbn still showing quite incorrect value (12800 in PAL), but the workaround is more than adequate, and files play correctly, thank you.

comment:9 by Carl Eugen Hoyos, 11 years ago

If -r 30 is not adequate please use -r 30000/1001

comment:10 by Michael Niedermayer, 11 years ago

patch on ffmpeg-devel

comment:11 by Carl Eugen Hoyos, 11 years ago

Component: undeterminedavformat
Keywords: mpegps removed
Resolution: fixed
Status: newclosed
Summary: Setting mov timecode fails when remuxing from mpegps because of high tbc valueSetting mov timecode fails when remuxing mpegvideo because of high tbc value

Fixed by Michael in 2501f6d.

Note: See TracTickets for help on using tickets.