FFmpeg | 18 Apr 02:28 2012

#1226(avcodec:new): CDG transcode to AVI at wrong frame rate (duration)

#1226: CDG transcode to AVI at wrong frame rate (duration)
-------------------------------------+-------------------------------------
             Reporter:  scottley     |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avcodec      |                  Version:  git-
             Keywords:  cdg frame    |  master
  rate                               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 I'm having a new issue with using ffmpeg to convert CDG to x264/AVI.

 The problem is that in the output file, the audio plays back at the
 correct rate, but the video whizzes by about 7 times too fast, so it's
 comepletely out of sync with the audio.  After 30 seconds, the audio
 continues, but the video has ended.

 I tried to lock down the input frame rate by using "-r 30", but it appears
 to be unsupported by the CDG decoder.

 On my older machine, with an older build, everything works fine.

 I've attached both the working and not-working command lines, version
 summaries and processing output below:

 = Current Configuration (video too fast) =
 Ubuntu 11.10 -- manually built ffmpeg

 == Command Line: ==

 {{{
 ffmpeg -threads 2 -i track02.cdg -i track02.mp3 -f avi -b:v 450k -acodec
 copy -vcodec libx264 -preset slower -qp 0 -b 450k -sws_flags
 print_info+neighbor -s 640x480 -r 30 -y track02.avi
 }}}
 == Output Messages ==
 {{{
 ffmpeg -threads 2 -i track02.cdg -i track02.mp3 -f avi -acodec copy
 -vcodec libx264 -preset slower -qp 0 -b 450k -sws_flags
 print_info+neighbor -s 640x480 -r 30 -y track02.avi
 ffmpeg version N-34020-ga666752 Copyright (c) 2000-2012 the FFmpeg
 developers
   built on Apr 17 2012 15:48:28 with gcc 4.6.1
   configuration: --enable-gpl --enable-libfaac --enable-libmp3lame
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora
 --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3
 --enable-x11grab
   libavutil      51. 46.100 / 51. 46.100
   libavcodec     54. 14.101 / 54. 14.101
   libavformat    54.  3.100 / 54.  3.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 70.100 /  2. 70.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 11.100 /  0. 11.100
   libpostproc    52.  0.100 / 52.  0.100
 [cdg  <at>  0x342b180] max_analyze_duration 5000000 reached at 5000000
 Input #0, cdg, from 'track02.cdg':
   Duration: 00:03:51.40, bitrate: 57 kb/s
     Stream #0:0: Video: cdgraphics, pal8, 300x216, 300 fps, 300 tbr, 300
 tbn, 300 tbc
 [mp3  <at>  0x342b9a0] max_analyze_duration 5000000 reached at 5015510
 Input #1, mp3, from 'track02.mp3':
   Metadata:
     encoder         : Lavf54.2.100
   Duration: 00:03:51.47, start: 0.000000, bitrate: 168 kb/s
     Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16, 32 kb/s
 Please use -b:a or -b:v, -b is ambiguous
 [buffer  <at>  0x34d2a80] w:300 h:216 pixfmt:pal8 tb:1/1000000 sar:0/1
 sws_param:flags=2
 [swscaler  <at>  0x34e6c00] Nearest Neighbor / POINT scaler, from pal8 to
 yuv420p using MMX2
 [swscaler  <at>  0x34edf60] Nearest Neighbor / POINT scaler, from pal8 to
 yuv420p using MMX2
 [swscaler  <at>  0x34f6980] Nearest Neighbor / POINT scaler, from pal8 to
 yuv420p using MMX2
 [scale  <at>  0x34d4840] w:300 h:216 fmt:pal8 sar:0/1 -> w:640 h:480
 fmt:yuv420p sar:0/1 flags:0x1010
 [libx264  <at>  0x342c0c0] using cpu capabilities: MMX2 SSE2Fast SSSE3
 FastShuffle SSE4.2 AVX
 [libx264  <at>  0x342c0c0] profile High 4:4:4 Predictive, level 3.1, 4:2:0
 8-bit
 Output #0, avi, to 'track02.avi':
   Metadata:
     ISFT            : Lavf54.3.100
     Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 640x480, q=-1--
 1, 450 kb/s, 30 tbn, 30 tbc
     Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, 32
 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (cdgraphics -> libx264)
   Stream #1:0 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 tile is out of rangeq=0.0 size=     865kB time=00:00:25.56 bitrate=
 277.2kbits/s dup=0 drop=6951
 Error while decoding stream #0:0
 Truncating packet of size 24 to 1  1039kB time=00:00:30.30 bitrate=
 280.9kbits/s dup=0 drop=8238
 AV Filter told us it has a frame available but failed to output one
 Error while decoding stream #1:0
 AV Filter told us it has a frame available but failed to output one
 Error while decoding stream #1:0
 AV Filter told us it has a frame available but failed to output one
             ^---- this repeated several thousand times ----^
 frame=  928 fps=135 q=-1.0 Lsize=    5482kB time=00:00:30.93
 bitrate=1451.7kbits/s dup=0 drop=8343
 video:481kB audio:4760kB global headers:0kB muxing overhead 4.588066%
 [libx264  <at>  0x2cb60c0] frame I:8     Avg QP: 0.00  size:   626
 [libx264  <at>  0x2cb60c0] frame P:920   Avg QP: 0.00  size:   530
 [libx264  <at>  0x2cb60c0] mb I  I16..4: 99.2%  0.0%  0.8%
 [libx264  <at>  0x2cb60c0] mb P  I16..4:  1.8%  0.0%  0.5%  P16..4:  0.4%  0.1%
 0.1%  0.1%  0.0%    skip:97.1%
 [libx264  <at>  0x2cb60c0] 8x8 transform intra:0.4% inter:2.4%
 [libx264  <at>  0x2cb60c0] coded y,uvDC,uvAC intra: 14.6% 22.0% 21.8% inter:
 0.1% 0.3% 0.3%
 [libx264  <at>  0x2cb60c0] i16 v,h,dc,p: 96%  3%  1%  0%
 [libx264  <at>  0x2cb60c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 53% 39%  8%  0%  0%
 0%  0%  0%  0%
 [libx264  <at>  0x2cb60c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 60% 25% 14%  0%  0%
 0%  0%  0%  0%
 [libx264  <at>  0x2cb60c0] i8c dc,h,v,p: 75%  9% 15%  0%
 [libx264  <at>  0x2cb60c0] Weighted P-Frames: Y:1.5% UV:1.5%
 [libx264  <at>  0x2cb60c0] ref P L0: 85.1%  0.0% 12.3%  1.0%  0.4%  0.4%  0.3%
 0.4%  0.1%
 [libx264  <at>  0x2cb60c0] kb/s:127.35
 }}}
 == ffmpeg -v 9 -loglevel 99 -i track02.cdg -i track02.mp3 ==
 {{{
 ffmpeg version N-34020-ga666752 Copyright (c) 2000-2012 the FFmpeg
 developers
   built on Apr 17 2012 15:48:28 with gcc 4.6.1
   configuration: --enable-gpl --enable-libfaac --enable-libmp3lame
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora
 --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3
 --enable-x11grab
   libavutil      51. 46.100 / 51. 46.100
   libavcodec     54. 14.101 / 54. 14.101
   libavformat    54.  3.100 / 54.  3.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 70.100 /  2. 70.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 11.100 /  0. 11.100
   libpostproc    52.  0.100 / 52.  0.100
 [cdg  <at>  0x3121080] Format cdg probed with size=2048 and score=50
 [cdg  <at>  0x3121080] File position before avformat_find_stream_info() is 0
 [cdg  <at>  0x3121080] max_analyze_duration 5000000 reached at 5000000
 [cdg  <at>  0x3121080] File position after avformat_find_stream_info() is
 183984
 Input #0, cdg, from 'track02.cdg':
   Duration: 00:03:51.40, bitrate: 57 kb/s
     Stream #0:0, 1502, 1/300: Video: cdgraphics, pal8, 300x216, 1/300, 300
 fps, 300 tbr, 300 tbn, 300 tbc
 [mp3  <at>  0x31218a0] Format mp3 probed with size=2048 and score=51
 [mp3  <at>  0x31218a0] File position before avformat_find_stream_info() is 660
 [mp3  <at>  0x31218a0] max_analyze_duration 5000000 reached at 5015510
 [mp3  <at>  0x31218a0] File position after avformat_find_stream_info() is 21140
 Input #1, mp3, from 'track02.mp3':
   Metadata:
     encoder         : Lavf54.2.100
   Duration: 00:03:51.47, start: 0.000000, bitrate: 168 kb/s
     Stream #1:0, 194, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16, 32
 kb/s
 At least one output file must be specified
 }}}

 = Older Configuration (works fine) =
 Ubuntu 10.04 -- manually built ffmpeg

 == Command Line: ==

 {{{
 ffmpeg -threads 2 -i track02.cdg -i track02.mp3 -f avi -b 450k -vcodec
 libx264 -sws_flags print_info+neighbor -acodec copy -vpre lossless_slower
 -s 640x480 -r 30 -y track02.avi
 }}}
 == Output Messages: ==
 {{{
 FFmpeg version SVN-r25179, Copyright (c) 2000-2010 the FFmpeg developers
   built on Sep 24 2010 10:16:28 with gcc 4.4.3
   configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-
 postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-
 amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-
 libxvid --enable-x11grab
   libavutil     50.28. 0 / 50.28. 0
   libavcore      0. 9. 0 /  0. 9. 0
   libavcodec    52.90. 0 / 52.90. 0
   libavformat   52.78. 5 / 52.78. 5
   libavdevice   52. 2. 2 / 52. 2. 2
   libavfilter    1.40. 0 /  1.40. 0
   libswscale     0.11. 0 /  0.11. 0
   libpostproc   51. 2. 0 / 51. 2. 0
 [cdg  <at>  0x12d5470] max_analyze_duration reached
 Input #0, cdg, from 'track02.cdg':
   Duration: 00:03:51.40, bitrate: 57 kb/s
     Stream #0.0: Video: cdgraphics, pal8, 300x216, 300 fps, 300 tbr, 300
 tbn, 300 tbc
 [mp3  <at>  0x1313e60] max_analyze_duration reached
 Input #1, mp3, from 'track02.mp3':
   Metadata:
     TSSE            : Lavf54.2.100
   Duration: 00:03:51.47, start: 0.000000, bitrate: 168 kb/s
     Stream #1.0: Audio: mp3, 44100 Hz, 2 channels, s16, 168 kb/s
 [swscaler  <at>  0x1339e30] Nearest Neighbor / POINT scaler, from pal8 to
 yuv420p using MMX2
 [buffer  <at>  0x132aa10] w:300 h:216 pixfmt:pal8
 [scale  <at>  0x132ada0] w:300 h:216 fmt:pal8 -> w:640 h:480 fmt:yuv420p
 flags:0x1010
 [swscaler  <at>  0x13494e0] Nearest Neighbor / POINT scaler, from pal8 to
 yuv420p using MMX2
 [libx264  <at>  0x1326760] using cpu capabilities: MMX2 SSE2Fast SSSE3
 FastShuffle SSE4.1 Cache64
 [libx264  <at>  0x1326760] profile High 4:4:4 Predictive, level 3.0, bit depth
 8
 Output #0, avi, to 'aviout/track02.avi':
   Metadata:
     ISFT            : Lavf52.78.5
     Stream #0.0: Video: libx264, yuv420p, 640x480, q=10-51, 450 kb/s, 30
 tbn, 30 tbc
     Stream #0.1: Audio: U[0][0][0] / 0x0055, 44100 Hz, 2 channels, 168
 kb/s
 Stream mapping:
   Stream #0.0 -> #0.0
   Stream #1.0 -> #0.1
 Press [q] to stop encoding
 [cdgraphics  <at>  0x12d6720] tile is out of rangee=190.90 bitrate=
 207.3kbits/s dup=0 drop=5462
 Error while decoding stream #0.0
 frame= 2649 fps=167 q=-1.0 Lsize=    5880kB time=221.73 bitrate=
 217.2kbits/s dup=0 drop=6622
 video:744kB audio:4760kB global headers:0kB muxing overhead 6.820693%
 frame I:12    Avg QP: 0.00  size:  5076
 [libx264  <at>  0x1326760] frame P:2637  Avg QP: 0.00  size:   266
 [libx264  <at>  0x1326760] mb I  I16..4: 92.3%  0.1%  7.6%
 [libx264  <at>  0x1326760] mb P  I16..4:  0.3%  0.0%  0.2%  P16..4:  0.1%  0.0%
 0.1%  0.0%  0.0%    skip:99.3%
 [libx264  <at>  0x1326760] 8x8 transform intra:0.6% inter:8.3%
 [libx264  <at>  0x1326760] coded y,uvDC,uvAC intra: 22.3% 31.9% 31.6% inter:
 0.1% 0.2% 0.2%
 [libx264  <at>  0x1326760] i16 v,h,dc,p: 92%  6%  2%  0%
 [libx264  <at>  0x1326760] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 55% 36%  9%  0%  0%
 0%  0%  0%  0%
 [libx264  <at>  0x1326760] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 59% 27% 14%  0%  0%
 0%  0%  0%  0%
 [libx264  <at>  0x1326760] i8c dc,h,v,p: 65% 13% 22%  0%
 [libx264  <at>  0x1326760] Weighted P-Frames: Y:0.0%
 [libx264  <at>  0x1326760] ref P L0: 92.2%  0.1%  5.2%  1.7%  0.8%
 [libx264  <at>  0x1326760] kb/s:27.49
 }}}

 == ffmpeg -v 9 -loglevel 99 -i track02.cdg -i track02.mp3 ==
 {{{
 FFmpeg version SVN-r25179, Copyright (c) 2000-2010 the FFmpeg developers
   built on Sep 24 2010 10:16:28 with gcc 4.4.3
   configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-
 postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-
 amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-
 libxvid --enable-x11grab
   libavutil     50.28. 0 / 50.28. 0
   libavcore      0. 9. 0 /  0. 9. 0
   libavcodec    52.90. 0 / 52.90. 0
   libavformat   52.78. 5 / 52.78. 5
   libavdevice   52. 2. 2 / 52. 2. 2
   libavfilter    1.40. 0 /  1.40. 0
   libswscale     0.11. 0 /  0.11. 0
   libpostproc   51. 2. 0 / 51. 2. 0
 [NULL  <at>  0x26f9470] Probed with size=2048 and score=50
 [cdg  <at>  0x26f9470] max_analyze_duration reached
 Input #0, cdg, from 'track02.cdg':
   Duration: 00:03:51.40, bitrate: 57 kb/s
     Stream #0.0, 1502, 1/300: Video: cdgraphics, pal8, 300x216, 1/300, 300
 fps, 300 tbr, 300 tbn, 300 tbc
 [NULL  <at>  0x2737ad0] Probed with size=2048 and score=51
 [mp3  <at>  0x2737ad0] max_analyze_duration reached
 Input #1, mp3, from 'track02.mp3':
   Metadata:
     TSSE            : Lavf54.2.100
   Duration: 00:03:51.47, start: 0.000000, bitrate: 168 kb/s
     Stream #1.0, 194, 1/14112000: Audio: mp3, 44100 Hz, 2 channels, s16,
 168 kb/s
 At least one output file must be specified
 }}}

--

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1226>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

Gmane