[FFmpeg-trac] #7677(undetermined:new): Some converted video files fail miserably with Apple video players

FFmpeg trac at avcodec.org
Sun Jan 13 12:04:57 EET 2019


#7677: Some converted video files fail miserably with Apple video players
-------------------------------------+-------------------------------------
             Reporter:  forthrin     |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 I'm converting videos to watch on a 3rd generation iPod Nano. Most videos
 work fine, but maybe 10% of all videos, specifically around 12 minutes,
 either stop (the video player exits back to the list of videos), or
 video/audio gets out of sync (video skips ahead several minutes, while
 audio keeps correct position).

 Interestingly, videos that fail on the iPod Nano also fail in iTunes and
 QuickTime on the Mac, but in different places. One video plays fine in
 QuickTime until 3:45, after which video fails to play while audio plays
 fine. At this point, pausing QuickTime causes VTDecoderXPCService to use
 max CPU.

 Notice also:

 - The videos play fine in VLC (3.0.3) or mplayer (4.2.1) on macOS
 (10.12.6)
 - The problem persists if I remove the audio track (`ffmpeg -an`)

 By trial and error, I've noticed that explicitly setting the output
 framerate identical to the input framerate, the problem magically
 disappears. (I realise "identical" may not be the case, as there may be
 rounding involved.)

 At any rate, I'd like to understand the problem properly:

 - Is this a bug in FFmpeg or not?
 - Why do Apple video players gravely fail with some of these videos?
 - What is the proper way to solve the problem? (Since the input framerate
 may vary for input videos, I'd like to use an option that does not require
 me to manually change the command line)

 Attempt A: Converting without specifying the output framerate explicitly.


 {{{
 $ ffmpeg -hide_banner -y -i in.avi -vcodec libx264 -acodec aac -ac 2 -ar
 44100 -ab 128k -profile:v baseline -level 3.0 -pix_fmt yuv420p -vf
 scale=320:240 out.mp4
 Input #0, avi, from 'in.avi':
   Metadata:
     encoder         : transcode-1.0.2
   Duration: 00:51:32.02, start: 0.000000, bitrate: 952 kb/s
     Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID /
 0x44495658), yuv420p, 624x352 [SAR 1:1 DAR 39:22], 806 kb/s, 23.98 fps,
 23.98 tbr, 23.98 tbn, 23.98 tbc
     Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp,
 128 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
   Stream #0:1 -> #0:1 (mp3 (mp3float) -> aac (native))
 Press [q] to stop, [?] for help
 [mpeg4 @ 0x7ffe98831400] Video uses a non-standard and wasteful way to
 store B-frames ('packed B-frames'). Consider using the
 mpeg4_unpack_bframes bitstream filter without encoding but stream copy to
 fix it.
 [libx264 @ 0x7ffe98813000] using SAR=936/935
 [libx264 @ 0x7ffe98813000] using cpu capabilities: MMX2 SSE2Fast SSSE3
 SSE4.2 AVX FMA3 BMI2 AVX2
 [libx264 @ 0x7ffe98813000] profile Constrained Baseline, level 3.0
 [libx264 @ 0x7ffe98813000] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC
 codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options:
 cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1
 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0
 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6
 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250
 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1
 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 Output #0, mp4, to 'out.mp4':
   Metadata:
     encoder         : Lavf58.12.100
     Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
 320x240 [SAR 936:935 DAR 1248:935], q=-1--1, 23.98 fps, 2997003.00 tbn,
 23.98 tbc
     Metadata:
       encoder         : Lavc58.18.100 libx264
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
     Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo,
 fltp, 128 kb/s
     Metadata:
       encoder         : Lavc58.18.100 aac
 [mpeg4 @ 0x7ffe9882e200] Discarding excessive bitstream in packed xvid
 [mpeg4 @ 0x7ffe98834600] Discarding excessive bitstream in packed xvid
 frame=74135 fps=260 q=-1.0 Lsize=  144392kB time=00:51:32.03 bitrate=
 382.6kbits/s dup=2 drop=0 speed=10.8x
 video:94123kB audio:48522kB subtitle:0kB other streams:0kB global
 headers:0kB muxing overhead: 1.224464%
 [libx264 @ 0x7ffe98813000] frame I:739   Avg QP:20.80  size:  6684
 [libx264 @ 0x7ffe98813000] frame P:73396 Avg QP:24.20  size:  1246
 [libx264 @ 0x7ffe98813000] mb I  I16..4: 29.5%  0.0% 70.5%
 [libx264 @ 0x7ffe98813000] mb P  I16..4:  1.8%  0.0%  2.1%  P16..4: 40.3%
 14.3%  5.0%  0.0%  0.0%    skip:36.5%
 [libx264 @ 0x7ffe98813000] coded y,uvDC,uvAC intra: 51.2% 70.5% 32.0%
 inter: 15.6% 26.8% 1.3%
 [libx264 @ 0x7ffe98813000] i16 v,h,dc,p: 43% 20% 15% 22%
 [libx264 @ 0x7ffe98813000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 19% 17%  6%
 8%  8%  7%  6%  5%
 [libx264 @ 0x7ffe98813000] i8c dc,h,v,p: 55% 17% 21%  6%
 [libx264 @ 0x7ffe98813000] ref P L0: 81.9% 10.9%  7.2%
 [libx264 @ 0x7ffe98813000] kb/s:249.37
 [aac @ 0x7ffe99800c00] Qavg: 197.591
 }}}

 Attempt B: The exact same thing, only with "-r 23.98" explicitly added.


 {{{
 $ ffmpeg -hide_banner -y -i in.avi -r 23.98 -vcodec libx264 -acodec aac
 -ac 2 -ar 44100 -ab 128k -profile:v baseline -level 3.0 -pix_fmt yuv420p
 -vf scale=320:240 out.mp4
 Input #0, avi, from 'in.avi':
   Metadata:
     encoder         : transcode-1.0.2
   Duration: 00:51:32.02, start: 0.000000, bitrate: 952 kb/s
     Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID /
 0x44495658), yuv420p, 624x352 [SAR 1:1 DAR 39:22], 806 kb/s, 23.98 fps,
 23.98 tbr, 23.98 tbn, 23.98 tbc
     Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp,
 128 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
   Stream #0:1 -> #0:1 (mp3 (mp3float) -> aac (native))
 Press [q] to stop, [?] for help
 [mpeg4 @ 0x7fbc30827400] Video uses a non-standard and wasteful way to
 store B-frames ('packed B-frames'). Consider using the
 mpeg4_unpack_bframes bitstream filter without encoding but stream copy to
 fix it.
 [libx264 @ 0x7fbc31034400] using SAR=936/935
 [libx264 @ 0x7fbc31034400] using cpu capabilities: MMX2 SSE2Fast SSSE3
 SSE4.2 AVX FMA3 BMI2 AVX2
 [libx264 @ 0x7fbc31034400] profile Constrained Baseline, level 3.0
 [libx264 @ 0x7fbc31034400] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC
 codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options:
 cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1
 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0
 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6
 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250
 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1
 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 Output #0, mp4, to 'out.mp4':
   Metadata:
     encoder         : Lavf58.12.100
     Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
 320x240 [SAR 936:935 DAR 1248:935], q=-1--1, 23.98 fps, 19184 tbn, 23.98
 tbc
     Metadata:
       encoder         : Lavc58.18.100 libx264
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
     Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo,
 fltp, 128 kb/s
     Metadata:
       encoder         : Lavc58.18.100 aac
 [mpeg4 @ 0x7fbc30809000] Discarding excessive bitstream in packed xvid
 [mpeg4 @ 0x7fbc3082a600] Discarding excessive bitstream in packed xvid
 frame=74147 fps=285 q=-1.0 Lsize=  144391kB time=00:51:32.03 bitrate=
 382.5kbits/s dup=14 drop=0 speed=11.9x
 video:94121kB audio:48522kB subtitle:0kB other streams:0kB global
 headers:0kB muxing overhead: 1.224970%
 [libx264 @ 0x7fbc31034400] frame I:739   Avg QP:20.80  size:  6684
 [libx264 @ 0x7fbc31034400] frame P:73408 Avg QP:24.20  size:  1246
 [libx264 @ 0x7fbc31034400] mb I  I16..4: 29.5%  0.0% 70.5%
 [libx264 @ 0x7fbc31034400] mb P  I16..4:  1.8%  0.0%  2.1%  P16..4: 40.3%
 14.3%  5.0%  0.0%  0.0%    skip:36.5%
 [libx264 @ 0x7fbc31034400] coded y,uvDC,uvAC intra: 51.2% 70.5% 31.9%
 inter: 15.6% 26.8% 1.3%
 [libx264 @ 0x7fbc31034400] i16 v,h,dc,p: 43% 20% 15% 21%
 [libx264 @ 0x7fbc31034400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 19% 17%  6%
 8%  8%  7%  6%  5%
 [libx264 @ 0x7fbc31034400] i8c dc,h,v,p: 55% 17% 21%  6%
 [libx264 @ 0x7fbc31034400] ref P L0: 81.9% 10.9%  7.1%
 [libx264 @ 0x7fbc31034400] kb/s:249.36
 [aac @ 0x7fbc30812600] Qavg: 197.591
 }}}

 Version information:


 {{{
 $ ffmpeg
 ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
   built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
   configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared
 --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-
 avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl
 --enable-ffplay --enable-libass --enable-libfdk-aac --enable-libmp3lame
 --enable-libspeex --enable-libx264 --enable-libxvid --enable-opencl
 --enable-videotoolbox --disable-lzma --enable-nonfree
   libavutil      56. 14.100 / 56. 14.100
   libavcodec     58. 18.100 / 58. 18.100
   libavformat    58. 12.100 / 58. 12.100
   libavdevice    58.  3.100 / 58.  3.100
   libavfilter     7. 16.100 /  7. 16.100
   libavresample   4.  0.  0 /  4.  0.  0
   libswscale      5.  1.100 /  5.  1.100
   libswresample   3.  1.100 /  3.  1.100
   libpostproc    55.  1.100 / 55.  1.100
 }}}

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


More information about the FFmpeg-trac mailing list