Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg with h264_videotoolbox cannot encode a video properly #304

Closed
kkebo opened this issue Aug 28, 2021 · 12 comments
Closed

ffmpeg with h264_videotoolbox cannot encode a video properly #304

kkebo opened this issue Aug 28, 2021 · 12 comments

Comments

@kkebo
Copy link
Contributor

kkebo commented Aug 28, 2021

When I run the command like the following, the playback time of out.mov becomes very long.

ffmpeg -i Big_Buck_Bunny_1080_10s_5MB.mp4 -c:v h264_videotoolbox -an out.mov

In this case, the playback time of Big_Buck_Bunny_1080_10s_5MB.mp4 is 00:00:10.00, however, the one of out.mov is 92:17:02.23 as you can see from the following results. if you test in your own environment, you can download the input video here.

$ ffprobe Big_Buck_Bunny_1080_10s_5MB.mp4 
ffprobe version n4.4-80-gbf87bdd3f6 Copyright (c) 2007-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.11)
  configuration: --cc=clang --arch=arm64 --disable-asm --enable-cross-compile --enable-pthreads --enable-videotoolbox --disable-audiotoolbox --enable-libfreetype --enable-libzimg --
disable-network --disable-debug --disable-gpl --disable-nonfree
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Big_Buck_Bunny_1080_10s_5MB.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf57.63.100
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:00:10.00, start: 0.000000, bitrate: 3948 kb/s
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 3945 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
$ ffprobe out.mov 
ffprobe version n4.4-80-gbf87bdd3f6 Copyright (c) 2007-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.11)
  configuration: --cc=clang --arch=arm64 --disable-asm --enable-cross-compile --enable-pthreads --enable-videotoolbox --disable-audiotoolbox --enable-libfreetype --enable-libzimg --
disable-network --disable-debug --disable-gpl --disable-nonfree
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    title           : Big Buck Bunny, Sunflower version
    encoder         : Lavf58.76.100
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 92:17:02.23, start: 0.000000, bitrate: 0 kb/s
  Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 0 kb/s, SAR 1:1 DAR 16:9, 0.0009 fps, 30 tbr, 15360 tbn, 30720 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : FFMP
      encoder         : Lavc58.134.100 h264_videotoolbo

I think that the warning messages like [mov @ 0x10905c400] Invalid DTS: 34132480 PTS: 17066496 in output stream 0:0, replacing by guess might relate to the issue because they didn't appear in the macOS version.

$ ffmpeg -i Big_Buck_Bunny_1080_10s_5MB.mp4 -c:v h264_videotoolbox -an out.mov
ffmpeg version n4.4-80-gbf87bdd3f6 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.11)
  configuration: --cc=clang --arch=arm64 --disable-asm --enable-cross-compile --enable-pthreads --enable-videotoolbox --disable-audiotoolbox --enable-libfreetype --enable-libzimg --disable-network --disable-debug --disable-gpl --disable-nonfree
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Big_Buck_Bunny_1080_10s_5MB.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf57.63.100
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:00:10.00, start: 0.000000, bitrate: 3948 kb/s
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 3945 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_videotoolbox))
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
Output #0, mov, to 'out.mov':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf58.76.100
  Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc58.134.100 h264_videotoolbox
[h264_videotoolbox @ 0x109107000] Color range not set for yuv420p. Using MPEG range.
[mov @ 0x10905c400] Invalid DTS: 34132480 PTS: 17066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 68265984 PTS: 51200000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 102399488 PTS: 85332992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 136532480 PTS: 119466496 in output stream 0:0, replacing by guess
frame=   12 fps=0.0 q=-0.0 size=     256kB time=02:09:37.76 bitrate=   0.3kbits/s speed=1.43e+04x    
[mov @ 0x10905c400] Invalid DTS: 170665984 PTS: 153600000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 204799488 PTS: 187732992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 255999488 PTS: 238932992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 290132480 PTS: 273066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 324265984 PTS: 307200000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 358399488 PTS: 341332992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 392532480 PTS: 375466496 in output stream 0:0, replacing by guess
frame=   28 fps= 26 q=-0.0 size=     256kB time=07:24:26.63 bitrate=   0.1kbits/s speed=2.45e+04x    
[mov @ 0x10905c400] Invalid DTS: 443732480 PTS: 426666496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 477865984 PTS: 460800000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 511999488 PTS: 494932992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 546132480 PTS: 529066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 580265984 PTS: 563200000 in output stream 0:0, replacing by guess
frame=   39 fps= 24 q=-0.0 size=     256kB time=10:48:08.83 bitrate=   0.1kbits/s speed=2.44e+04x    
[mov @ 0x10905c400] Invalid DTS: 614399488 PTS: 597332992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 665599488 PTS: 648532992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 699732480 PTS: 682666496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 733865984 PTS: 716800000 in output stream 0:0, replacing by guess
frame=   48 fps= 22 q=-0.0 size=     512kB time=13:34:48.83 bitrate=   0.1kbits/s speed=2.28e+04x    
[mov @ 0x10905c400] Invalid DTS: 767999488 PTS: 750932992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 802132480 PTS: 785066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 853332480 PTS: 836266496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 887465984 PTS: 870400000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 921599488 PTS: 904532992 in output stream 0:0, replacing by guess
frame=   58 fps= 22 q=-0.0 size=     512kB time=16:21:28.86 bitrate=   0.1kbits/s speed=2.21e+04x    
[mov @ 0x10905c400] Invalid DTS: 955732480 PTS: 938666496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 989865984 PTS: 972800000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1023999488 PTS: 1006932992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1075199488 PTS: 1058132992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1109332480 PTS: 1092266496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1143465984 PTS: 1126400000 in output stream 0:0, replacing by guess
frame=   71 fps= 22 q=-0.0 size=     512kB time=20:22:13.33 bitrate=   0.1kbits/s speed=2.31e+04x    
[mov @ 0x10905c400] Invalid DTS: 1177599488 PTS: 1160532992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1211732480 PTS: 1194666496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1262932480 PTS: 1245866496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1297065984 PTS: 1280000000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1331199488 PTS: 1314132992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1365332480 PTS: 1348266496 in output stream 0:0, replacing by guess
frame=   85 fps= 23 q=-0.0 size=     512kB time=24:59:59.96 bitrate=   0.0kbits/s speed=2.44e+04x    
[mov @ 0x10905c400] Invalid DTS: 1399465984 PTS: 1382400000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1433599488 PTS: 1416532992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1484799488 PTS: 1467732992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1518932480 PTS: 1501866496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1553065984 PTS: 1536000000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1587199488 PTS: 1570132992 in output stream 0:0, replacing by guess
frame=   98 fps= 23 q=-0.0 size=     512kB time=29:00:44.40 bitrate=   0.0kbits/s speed=2.47e+04x    
[mov @ 0x10905c400] Invalid DTS: 1621332480 PTS: 1604266496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1672532480 PTS: 1655466496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1706665984 PTS: 1689600000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1740799488 PTS: 1723732992 in output stream 0:0, replacing by guess
frame=  107 fps= 22 q=-0.0 size=     512kB time=31:47:24.40 bitrate=   0.0kbits/s speed=2.39e+04x    
[mov @ 0x10905c400] Invalid DTS: 1774932480 PTS: 1757866496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1809065984 PTS: 1792000000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1843199488 PTS: 1826132992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1894399488 PTS: 1877332992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1928532480 PTS: 1911466496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1962665984 PTS: 1945600000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 1996799488 PTS: 1979732992 in output stream 0:0, replacing by guess
frame=  121 fps= 23 q=-0.0 size=     768kB time=35:48:08.86 bitrate=   0.0kbits/s speed=2.43e+04x    
[mov @ 0x10905c400] Invalid DTS: 2030932480 PTS: 2013866496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2082132480 PTS: 2065066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2116265984 PTS: 2099200000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2150399488 PTS: 2133332992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2184532480 PTS: 2167466496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2218665984 PTS: 2201600000 in output stream 0:0, replacing by guess
frame=  135 fps= 23 q=-0.0 size=     768kB time=40:25:55.50 bitrate=   0.0kbits/s speed=2.51e+04x    
[mov @ 0x10905c400] Invalid DTS: 2252799488 PTS: 2235732992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2303999488 PTS: 2286932992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2338132480 PTS: 2321066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2372265984 PTS: 2355200000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2406399488 PTS: 2389332992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2440532480 PTS: 2423466496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2491732480 PTS: 2474666496 in output stream 0:0, replacing by guess
frame=  151 fps= 24 q=-0.0 size=     768kB time=45:22:13.30 bitrate=   0.0kbits/s speed=2.59e+04x    
[mov @ 0x10905c400] Invalid DTS: 2525865984 PTS: 2508800000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2559999488 PTS: 2542932992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2594132480 PTS: 2577066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2628265984 PTS: 2611200000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2662399488 PTS: 2645332992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2713599488 PTS: 2696532992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2747732480 PTS: 2730666496 in output stream 0:0, replacing by guess
frame=  166 fps= 24 q=-0.0 size=     768kB time=49:59:59.96 bitrate=   0.0kbits/s speed=2.62e+04x    
[mov @ 0x10905c400] Invalid DTS: 2781865984 PTS: 2764800000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2815999488 PTS: 2798932992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2850132480 PTS: 2833066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2901332480 PTS: 2884266496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2935465984 PTS: 2918400000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 2969599488 PTS: 2952532992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3003732480 PTS: 2986666496 in output stream 0:0, replacing by guess
frame=  180 fps= 24 q=-0.0 size=     768kB time=54:00:44.43 bitrate=   0.0kbits/s speed=2.63e+04x    
[mov @ 0x10905c400] Invalid DTS: 3037865984 PTS: 3020800000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3071999488 PTS: 3054932992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3123199488 PTS: 3106132992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3157332480 PTS: 3140266496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3191465984 PTS: 3174400000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3225599488 PTS: 3208532992 in output stream 0:0, replacing by guess
frame=  194 fps= 24 q=-0.0 size=     768kB time=58:38:31.06 bitrate=   0.0kbits/s speed=2.66e+04x    
[mov @ 0x10905c400] Invalid DTS: 3259732480 PTS: 3242666496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3310932480 PTS: 3293866496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3345065984 PTS: 3328000000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3379199488 PTS: 3362132992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3413332480 PTS: 3396266496 in output stream 0:0, replacing by guess
frame=  205 fps= 24 q=-0.0 size=    1024kB time=62:02:13.30 bitrate=   0.0kbits/s speed=2.63e+04x    
[mov @ 0x10905c400] Invalid DTS: 3447465984 PTS: 3430400000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3481599488 PTS: 3464532992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3532799488 PTS: 3515732992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3566932480 PTS: 3549866496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3601065984 PTS: 3584000000 in output stream 0:0, replacing by guess
frame=  216 fps= 24 q=-0.0 size=    1024kB time=65:25:55.50 bitrate=   0.0kbits/s speed=2.62e+04x    
[mov @ 0x10905c400] Invalid DTS: 3635199488 PTS: 3618132992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3669332480 PTS: 3652266496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3720532480 PTS: 3703466496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3754665984 PTS: 3737600000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3788799488 PTS: 3771732992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3822932480 PTS: 3805866496 in output stream 0:0, replacing by guess
frame=  229 fps= 24 q=-0.0 size=    1024kB time=69:26:39.96 bitrate=   0.0kbits/s speed=2.62e+04x    
[mov @ 0x10905c400] Invalid DTS: 3857065984 PTS: 3840000000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3891199488 PTS: 3874132992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3942399488 PTS: 3925332992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 3976532480 PTS: 3959466496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4010665984 PTS: 3993600000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4044799488 PTS: 4027732992 in output stream 0:0, replacing by guess
frame=  242 fps= 24 q=-0.0 size=    1024kB time=73:27:24.40 bitrate=   0.0kbits/s speed=2.63e+04x    
[mov @ 0x10905c400] Invalid DTS: 4078932480 PTS: 4061866496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4130132480 PTS: 4113066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4164265984 PTS: 4147200000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4198399488 PTS: 4181332992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4232532480 PTS: 4215466496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4266665984 PTS: 4249600000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4300799488 PTS: 4283732992 in output stream 0:0, replacing by guess
frame=  257 fps= 24 q=-0.0 size=    1024kB time=78:05:11.06 bitrate=   0.0kbits/s speed=2.66e+04x    
[mov @ 0x10905c400] Invalid DTS: 4351999488 PTS: 4334932992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4386132480 PTS: 4369066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4420265984 PTS: 4403200000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4454399488 PTS: 4437332992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4488532480 PTS: 4471466496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4539732480 PTS: 4522666496 in output stream 0:0, replacing by guess
frame=  271 fps= 24 q=-0.0 size=    1024kB time=82:24:26.63 bitrate=   0.0kbits/s speed=2.68e+04x    
[mov @ 0x10905c400] Invalid DTS: 4573865984 PTS: 4556800000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4607999488 PTS: 4590932992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4642132480 PTS: 4625066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4676265984 PTS: 4659200000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4710399488 PTS: 4693332992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4761599488 PTS: 4744532992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4795732480 PTS: 4778666496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4829865984 PTS: 4812800000 in output stream 0:0, replacing by guess
frame=  287 fps= 25 q=-0.0 size=    1280kB time=87:02:13.33 bitrate=   0.0kbits/s speed=2.7e+04x    
[mov @ 0x10905c400] Invalid DTS: 4863999488 PTS: 4846932992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4898132480 PTS: 4881066496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4949332480 PTS: 4932266496 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 4983465984 PTS: 4966400000 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 5017599488 PTS: 5000532992 in output stream 0:0, replacing by guess
[mov @ 0x10905c400] Invalid DTS: 5051732480 PTS: 5034666496 in output stream 0:0, replacing by guess
frame=  300 fps= 25 q=-0.0 size=    1280kB time=91:02:57.76 bitrate=   0.0kbits/s speed=2.71e+04x    
[mov @ 0x10905c400] Invalid DTS: 5085865984 PTS: 5068800000 in output stream 0:0, replacing by guess
FATAL error, file duration too long for timebase, this file will not be
playable with QuickTime. Choose a different timebase with -video_track_timescale or a different container format
frame=  300 fps= 25 q=-0.0 Lsize=    1377kB time=92:17:02.16 bitrate=   0.0kbits/s speed=2.72e+04x    
video:1369kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.513921%

Those warning messages didn't appear in the macOS version of ffmpeg, and the playback time of out.mov is also normal.

$ ffmpeg -i Big_Buck_Bunny_1080_10s_5MB.mp4 -c:v h264_videotoolbox -an out.mov
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.9)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Big_Buck_Bunny_1080_10s_5MB.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf57.63.100
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:00:10.00, start: 0.000000, bitrate: 3948 kb/s
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 3945 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_videotoolbox))
Press [q] to stop, [?] for help
Output #0, mov, to 'out.mov':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf58.76.100
  Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc58.134.100 h264_videotoolbox
[h264_videotoolbox @ 0x7fabae009a00] Color range not set for yuv420p. Using MPEG range.
frame=  300 fps=165 q=-0.0 Lsize=    1526kB time=00:00:09.93 bitrate=1258.4kbits/s speed=5.47x                                                                                        
video:1521kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.296806%
$ ffprobe out.mov
ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.9)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    title           : Big Buck Bunny, Sunflower version
    encoder         : Lavf58.76.100
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:00:10.00, start: 0.000000, bitrate: 1250 kb/s
  Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 1246 kb/s, 30 fps, 30 tbr, 15360 tbn, 30720 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : FFMP
      encoder         : Lavc58.134.100 h264_videotoolbo

The macOS version of ffmpeg I used was installed from Homebrew. The differences between the two are as follows.

a-Shell 1.7.5 (185) (TestFlight) (12.9-inch iPad Pro 5th generation running iPadOS 15 Developer Beta 7 (19A5337a)):

$ ffmpeg -version
ffmpeg version n4.4-80-gbf87bdd3f6 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.11)
configuration: --cc=clang --arch=arm64 --disable-asm --enable-cross-compile --enable-pthreads --enable-videotoolbox --disable-audiotoolbox --enable-libfreetype --enable-libzimg --di
sable-network --disable-debug --disable-gpl --disable-nonfree
libavutil      56. 70.100 / 56. 70.100
libavcodec     58.134.100 / 58.134.100
libavformat    58. 76.100 / 58. 76.100
libavdevice    58. 13.100 / 58. 13.100
libavfilter     7.110.100 /  7.110.100
libswscale      5.  9.100 /  5.  9.100
libswresample   3.  9.100 /  3.  9.100
$ ffmpeg -encoders | grep videotoolbox
  configuration: --cc=clang --arch=arm64 --disable-asm --enable-cross-compile --enable-pthreads --enable-videotoolbox --disable-audiotoolbox --enable-libfreetype --enable-libzimg --
disable-network --disable-debug --disable-gpl --disable-nonfree
 V..... h264_videotoolbox    VideoToolbox H.264 Encoder (codec h264)
 V..... hevc_videotoolbox    VideoToolbox H.265 Encoder (codec hevc)

macOS:

$ ffmpeg -version
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil      56. 70.100 / 56. 70.100
libavcodec     58.134.100 / 58.134.100
libavformat    58. 76.100 / 58. 76.100
libavdevice    58. 13.100 / 58. 13.100
libavfilter     7.110.100 /  7.110.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  9.100 /  5.  9.100
libswresample   3.  9.100 /  3.  9.100
libpostproc    55.  9.100 / 55.  9.100
$ ffmpeg -encoders | grep videotoolbox
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.9)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
 V..... h264_videotoolbox    VideoToolbox H.264 Encoder (codec h264)
 V..... hevc_videotoolbox    VideoToolbox H.265 Encoder (codec hevc)
$ brew info ffmpeg
ffmpeg: stable 4.4 (bottled), HEAD
Play, record, convert, and stream audio and video
https://ffmpeg.org/
/usr/local/Cellar/ffmpeg/4.4_2 (276 files, 52.4MB) *
  Poured from bottle on 2021-08-28 at 18:53:41
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/ffmpeg.rb
License: GPL-2.0-or-later
==> Dependencies
Build: nasm ✘, pkg-config ✔
Required: aom ✔, dav1d ✔, fontconfig ✔, freetype ✔, frei0r ✔, gnutls ✔, lame ✔, libass ✔, libbluray ✔, libsoxr ✔, libvidstab ✔, libvorbis ✔, libvpx ✔, opencore-amr ✔, openjpeg ✔, opus ✔, rav1e ✔, rubberband ✔, sdl2 ✔, snappy ✔, speex ✔, srt ✔, tesseract ✔, theora ✔, webp ✔, x264 ✔, x265 ✔, xvid ✔, xz ✔, zeromq ✔, zimg ✔
==> Options
--HEAD
        Install HEAD version
==> Analytics
install: 78,029 (30 days), 298,735 (90 days), 1,670,877 (365 days)
install-on-request: 62,053 (30 days), 243,570 (90 days), 1,379,795 (365 days)
build-error: 0 (30 days)
@holzschu
Copy link
Owner

I tried, and I cannot reproduce the issue (either with my own install of with a TestFlight install). Which means it's either related to a bug that happens after several runs of ffmpeg (which will be hard to debug) or to differences in system installs (which will be hard to debug).

These "Invalid DTS" were frequent when I was running the master version of ffmpeg, I haven't seen it since I compiled version 4.4.

@kkebo
Copy link
Contributor Author

kkebo commented Aug 28, 2021

Thanks for replying. Umm, it's weird. Maybe it's because of iPadOS 15. I will try on iOS 14.7.1 or iPadOS 14.7.1 later.

a bug that happens after several runs of ffmpeg

This is probably not the cause. In my environment, the issue happens even after all a-Shell windows are closed and a-Shell is force-quitted.

differences in system installs

I'll try in another device.

@holzschu
Copy link
Owner

My tests were on iPadOS 15 too. The mystery gets weirder.

@kkebo
Copy link
Contributor Author

kkebo commented Aug 28, 2021

I tested on two more devices.

iPhone XS running iOS 15 Developer Beta 7 (19A5337a)

I had not installed a-Shell on this device until then.

  1. Install a-Shell 1.7.5 (185) from the TestFlight
  2. Download the same video file
  3. Run ffmpeg -i Big_Buck_Bunny_1080_10s_5MB.mp4 -c:v h264_videotoolbox -an out.mov

Result: The issue was reproduced.

ffmpeg -i Big_Buck_Bunny_1080_10s_5MB.mp4 -c:v h264_videotoolbox -an out.mov ffprobe out.mov
D343B906-1553-4C29-A5E6-A221CF559C78 26903A14-54E0-4DFF-954E-75B192DDB294

11-inch iPad Pro 2nd generation running iPadOS 14.7.1

I have been using a-Shell on this device.

  1. Update a-Shell to 1.7.5 (185) on the TestFlight
  2. Download the same video file
  3. Run ffmpeg -i Big_Buck_Bunny_1080_10s_5MB.mp4 -c:v h264_videotoolbox -an out.mov

Result: The issue was not reproduced. The playback time of out.mov was same as Big_Buck_Bunny_1080_10s_5MB.mp4's, and no warnings appeared.

56D1CD85-947A-4C1B-B436-0D8D217718FC

@kkebo
Copy link
Contributor Author

kkebo commented Aug 28, 2021

@holzschu

My tests were on iPadOS 15 too. The mystery gets weirder.

Are you also using Developer Beta 7?

@holzschu
Copy link
Owner

Thanks. So it looks like a random issue, affecting some devices running iOS 15 developer beta 7, but not all of them. That's going to be tough to debug...

@kkebo
Copy link
Contributor Author

kkebo commented Aug 28, 2021

h264_videotoolbox is a hardware encoder, so the issue might depend on a hardware.

What's your device?

@kkebo
Copy link
Contributor Author

kkebo commented Aug 28, 2021

I tested two more other devices.

11-inch iPad Pro 3rd generation running iPadOS 14.7.1

Result: The issue was not reproduced.

11-inch iPad Pro 2nd generation running iPadOS 15 Developer Beta 7 (19A5337a)

Result: The issue was reproduced.

Current summary

In my case, I can reproduce the issue on all my iOS/iPadOS 15 devices. So, I want to know what device @holzschu tested on.

Reproduced:

  • 12.9-inch iPad Pro 5th generation running iPadOS 15 Developer Beta 7
  • iPhone XS running iOS 15 Developer Beta 7
  • 11-inch iPad Pro 2nd generation running iPadOS 15 Developer Beta 7

Not reproduced:

  • 11-inch iPad Pro 2nd generation running iPadOS 14.7.1
  • 11-inch iPad Pro 3rd generation running iPadOS 14.7.1

@kkebo
Copy link
Contributor Author

kkebo commented Aug 28, 2021

I added two test results. I found that iPad Air 2 cannot reproduce the issue even if running iPadOS 15 Developer Beta 7. I tried reinstalling a-Shell, but the result was the same. So I guess it depends on the hardware whether it reproduces or not.

Reproduced:

  • 12.9-inch iPad Pro 5th generation (M1) running iPadOS 15 Developer Beta 7
  • iPhone XS (A12) running iOS 15 Developer Beta 7
  • 11-inch iPad Pro 2nd generation (A12Z) running iPadOS 15 Developer Beta 7

Not reproduced:

  • 11-inch iPad Pro 2nd generation (A12Z) running iPadOS 14.7.1
  • 11-inch iPad Pro 3rd generation (M1) running iPadOS 14.7.1
  • iPad Air 2 (A8X) running iPadOS 14.5.1
  • iPad Air 2 (A8X) running iPadOS 15 Developer Beta 7

@holzschu
Copy link
Owner

Thank you for all these tests, and for including the processors. My hope is that it will get better once a-Shell (and ffmpeg) are compiled with Xcode 13 GM (once it is available). For now, all the builds are compiled with Xcode 12.5.

@kkebo
Copy link
Contributor Author

kkebo commented Nov 10, 2021

I don't know why, but it seems that this issue has been resolved in iPadOS 15.2 Beta 2 on my 12.9-inch iPad Pro 5th generation.

@kkebo
Copy link
Contributor Author

kkebo commented Nov 23, 2021

Good news! As a result of some experiments, at least iOS 15.0.2 or earlier has this issue, but it has been fixed in iOS 15.1.

@kkebo kkebo closed this as completed Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants