[FFmpeg-user] Encoding for HLS but have a DTS problem

Dominicans Interactive luuk at dominicansinteractive.com
Thu Jul 19 09:58:54 CEST 2012


On 18 Jul 2012, at 19:50, Michael Niedermayer wrote:

> On Tue, Jul 17, 2012 at 12:22:35PM +0100, Dominicans Interactive wrote:
>> Is there anybody with a suggestion what I could do?
> 
> You could look at the DTS stored in the mpegts file and if they are
> bad try to trace from where they come from.
> 
> explaining exactly how to reproduce the issue and providing links
> to all input files needed to reproduce it also should help
> 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> No snowflake in an avalanche ever feels responsible. -- Voltaire
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

Thanks Michael,

I am not that familiar with video encoding, so don't know if I can help you with the first suggestion.
But the file I use for testing can be found at:
http://test.idoms.org/public/testdata/test-movie/test.mov

The output of FFMPEG for this file seems ok as it doesn't give a DTS error (ffmpeg -loglevel 99 -i test.mov).

The command I use for encoding is:
ffmpeg -i ./test.mov -y -f mpegts -acodec aac -strict -2, -ar, 48000, -b:a, 128000, -s, 960x540, -vcodec, libx264, -b:v, 1200000, -aspect, 960:540, -r, 25, -level, 3.1, -vprofile, main, -flags, +loop, -cmp, +chroma, -partitions, +parti4x4+partp8x8+partb8x8, -subq, 5, -trellis, 1, -refs, 1, -coder, 0, -me_range, 16, -keyint_min, 25, -sc_threshold, 40, -i_qfactor, 0.71, -bt, 200k, -maxrate, 1200000, -bufsize, 1200000, -rc_eq, 'blurCplx^(1-qComp)', -qcomp, 0.6, -qmin, 10, -qmax, 51, -qdiff, 4, -level, 30, -g, 30, -async, 2, ./encoded.ts

I pass the uncut output below, as there is actually a PTS warning. If I now probe the file with FFMPEG (ffmpeg -loglevel 99 -i encoded.ts) I get:

ffmpeg -loglevel 99 -i encoded.ts
ffmpeg version N-42201-gab2356c Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul  4 2012 11:57:28 with llvm_gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-libvpx --enable-libfaac --enable-nonfree --enable-shared --disable-mmx --arch=x86_64
  libavutil      51. 63.100 / 51. 63.100
  libavcodec     54. 32.100 / 54. 32.100
  libavformat    54. 14.100 / 54. 14.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     3.  0.101 /  3.  0.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[mpegts @ 0x7fb73b03d800] Format mpegts probed with size=2048 and score=100
[mpegts @ 0x7fb73b03d800] stream=0 stream_type=1b pid=100 prog_reg_desc=
[mpegts @ 0x7fb73b03d800] stream=1 stream_type=f pid=101 prog_reg_desc=
[mpegts @ 0x7fb73b03d800] File position before avformat_find_stream_info() is 0
[h264 @ 0x7fb73b052e00] Current profile doesn't provide more RBSP data in PPS, skipping
[h264 @ 0x7fb73b052e00] no picture 
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 143280 in que
    Last message repeated 6 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 158640 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 175920 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 193200 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 210480 in que
    Last message repeated 7 times
[h264 @ 0x7fb73b052e00] Current profile doesn't provide more RBSP data in PPS, skipping
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 227760 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 245040 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 262320 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 279600 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 296880 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 314160 in que
    Last message repeated 7 times
[h264 @ 0x7fb73b052e00] Current profile doesn't provide more RBSP data in PPS, skipping
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 331440 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 348720 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 366000 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 383280 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 400560 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 417840 in que
    Last message repeated 6 times
[h264 @ 0x7fb73b052e00] Current profile doesn't provide more RBSP data in PPS, skipping
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 433200 in que
    Last message repeated 6 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 448560 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 465840 in que
    Last message repeated 6 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 481200 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 498480 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 515760 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 533040 in que
    Last message repeated 6 times
[h264 @ 0x7fb73b052e00] Current profile doesn't provide more RBSP data in PPS, skipping
[mpegts @ 0x7fb73b03d800] first_dts 124080 not matching first dts 548400 in que
    Last message repeated 7 times
[mpegts @ 0x7fb73b03d800] max_analyze_duration 5000000 reached at 5000000
[mpegts @ 0x7fb73b03d800] File position after avformat_find_stream_info() is 0
Input #0, mpegts, from 'encoded.ts':
  Duration: 00:00:24.18, start: 1.378667, bitrate: 1225 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100], 127, 1/90000: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 1/50, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101](eng), 230, 1/90000: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, s16, 117 kb/s
At least one output file must be specified
[AVIOContext @ 0x7fb73ac18300] Statistics: 905360 bytes read, 2 seeks

_________


Encoder output:
ffmpeg -i ./test.mov -y -f mpegts -acodec aac -strict -2 -ar 48000 -b:a 128000 -s 960x540 -vcodec libx264 -b:v 1200000 -aspect 960:540 -r 25 -level 3.1 -vprofile main -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 1200000 -bufsize 1200000 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -g 30 -async 2 ./encoded.ts
ffmpeg version N-42201-gab2356c Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul  4 2012 11:57:28 with llvm_gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-libvpx --enable-libfaac --enable-nonfree --enable-shared --disable-mmx --arch=x86_64
  libavutil      51. 63.100 / 51. 63.100
  libavcodec     54. 32.100 / 54. 32.100
  libavformat    54. 14.100 / 54. 14.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     3.  0.101 /  3.  0.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './test.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2011-12-05 10:54:24
    timecode        : 00:00:00:00
  Duration: 00:00:24.20, start: 0.000000, bitrate: 9912 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080, 9777 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
      creation_time   : 2011-12-05 10:56:28
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 129 kb/s
    Metadata:
      creation_time   : 2011-12-05 10:56:28
      handler_name    : Apple Sound Media Handler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      creation_time   : 2011-12-05 10:56:28
      handler_name    : Time Code Media Handler
      timecode        : 00:00:00:00
[graph 0 input from stream 0:0 @ 0x11111a080] w:1920 h:1080 pixfmt:yuv420p tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
[output stream 0:0 @ 0x11111a210] No opaque field provided
[scaler for output stream 0:0 @ 0x11111a560] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:960 h:540 fmt:yuv420p sar:0/1 flags:0x4
[graph 1 input from stream 0:1 @ 0x11111d4e0] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
-async is forwarded to lavfi similarly to -af aresample=min_comp=0.001:min_hard_comp=0.100000:max_soft_comp=0.000042.
[graph 1 aresample for input stream 0:1 @ 0x11111d640] chl:stereo fmt:s16 r:48000Hz -> chl:stereo fmt:flt r:48000Hz
[libx264 @ 0x7f87e214fe00] using SAR=1/1
[libx264 @ 0x7f87e214fe00] frame MB size (60x34) > level limit (1620)
[libx264 @ 0x7f87e214fe00] DPB size (4 frames, 3133440 bytes) > level limit (3 frames, 3110400 bytes)
[libx264 @ 0x7f87e214fe00] MB rate (51000) > level limit (40500)
[libx264 @ 0x7f87e214fe00] using cpu capabilities: none!
[libx264 @ 0x7f87e214fe00] profile Main, level 3.0
[mpegts @ 0x7f87e214f800] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to './encoded.ts':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    timecode        : 00:00:00:00
    encoder         : Lavf54.14.100
    Stream #0:0(eng): Video: h264, yuv420p, 960x540 [SAR 1:1 DAR 16:9], q=10-51, 1200 kb/s, 90k tbn, 25 tbc
    Metadata:
      creation_time   : 2011-12-05 10:56:28
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: aac, 48000 Hz, stereo, flt, 128 kb/s
    Metadata:
      creation_time   : 2011-12-05 10:56:28
      handler_name    : Apple Sound Media Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (aac -> aac)
Press [q] to stop, [?] for help
frame=   17 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=   0.0kbits/sframe=   36 fps= 35 q=0.0 size=       0kB time=00:00:00.00 bitrate=   0.0kbits/sframe=   47 fps= 31 q=20.0 size=       3kB time=00:00:00.-4 bitrate=-601.6kbits/Encoder did not produce proper pts, making some up.
frame=   62 fps= 30 q=10.0 size=      36kB time=00:00:00.56 bitrate= 529.1kbits/frame=   76 fps= 30 q=10.0 size=      66kB time=00:00:01.12 bitrate= 486.1kbits/frame=   91 fps= 30 q=10.0 size=     102kB time=00:00:01.72 bitrate= 487.9kbits/frame=  104 fps= 29 q=22.0 size=     123kB time=00:00:02.24 bitrate= 449.9kbits/frame=  116 fps= 28 q=26.0 size=     232kB time=00:00:02.72 bitrate= 700.0kbits/frame=  126 fps= 27 q=22.0 size=     309kB time=00:00:03.12 bitrate= 811.3kbits/frame=  138 fps= 27 q=25.0 size=     439kB time=00:00:03.60 bitrate= 998.9kbits/frame=  150 fps= 27 q=30.0 size=     527kB time=00:00:04.08 bitrate=1057.6kbits/frame=  164 fps= 26 q=33.0 size=     592kB time=00:00:04.64 bitrate=1044.4kbits/frame=  176 fps= 26 q=31.0 size=     647kB time=00:00:05.12 bitrate=1035.8kbits/frame=  189 fps= 26 q=23.0 size=     760kB time=00:00:05.64 bitrate=1104.5kbits/frame=  204 fps= 26 q=30.0 size=     923kB time=00:00:06.24 bitrate=1212.1kbits/frame=  219 fps= 27 q=41.0 size=     971kB time=00:00:06.84 bitrate=1163.0kbits/frame=  235 fps= 27 q=41.0 size=    1117kB time=00:00:07.48 bitrate=1223.7kbits/frame=  250 fps= 27 q=36.0 size=    1130kB time=00:00:08.08 bitrate=1145.5kbits/frame=  264 fps= 27 q=36.0 size=    1239kB time=00:00:08.64 bitrate=1174.8kbits/frame=  280 fps= 27 q=34.0 size=    1274kB time=00:00:09.28 bitrate=1124.4kbits/frame=  296 fps= 27 q=26.0 size=    1434kB time=00:00:09.92 bitrate=1184.4kbits/frame=  312 fps= 27 q=31.0 size=    1474kB time=00:00:10.56 bitrate=1143.7kbits/frame=  328 fps= 28 q=26.0 size=    1653kB time=00:00:11.20 bitrate=1209.1kbits/frame=  343 fps= 28 q=30.0 size=    1678kB time=00:00:11.80 bitrate=1164.8kbits/frame=  358 fps= 28 q=24.0 size=    1832kB time=00:00:12.40 bitrate=1210.1kbits/frame=  373 fps= 28 q=25.0 size=    1857kB time=00:00:13.00 bitrate=1170.2kbits/frame=  388 fps= 28 q=20.0 size=    2015kB time=00:00:13.60 bitrate=1214.0kbits/frame=  403 fps= 28 q=24.0 size=    2047kB time=00:00:14.20 bitrate=1181.0kbits/frame=  418 fps= 28 q=20.0 size=    2212kB time=00:00:14.80 bitrate=1224.1kbits/frame=  433 fps= 28 q=29.0 size=    2253kB time=00:00:15.40 bitrate=1198.4kbits/frame=  448 fps= 28 q=23.0 size=    2408kB time=00:00:16.00 bitrate=1232.8kbits/frame=  462 fps= 28 q=31.0 size=    2440kB time=00:00:16.56 bitrate=1207.1kbits/frame=  476 fps= 28 q=24.0 size=    2590kB time=00:00:17.12 bitrate=1239.5kbits/frame=  491 fps= 28 q=36.0 size=    2618kB time=00:00:17.72 bitrate=1210.2kbits/frame=  507 fps= 28 q=32.0 size=    2793kB time=00:00:18.36 bitrate=1246.1kbits/frame=  522 fps= 28 q=22.0 size=    2817kB time=00:00:18.96 bitrate=1217.2kbits/frame=  537 fps= 28 q=22.0 size=    2980kB time=00:00:19.56 bitrate=1248.1kbits/frame=  551 fps= 28 q=32.0 size=    3068kB time=00:00:20.12 bitrate=1249.1kbits/frame=  564 fps= 28 q=32.0 size=    3190kB time=00:00:20.64 bitrate=1266.1kbits/frame=  580 fps= 28 q=35.0 size=    3236kB time=00:00:21.28 bitrate=1245.8kbits/frame=  595 fps= 28 q=35.0 size=    3382kB time=00:00:21.88 bitrate=1266.4kbits/frame=  605 fps= 27 q=0.0 Lsize=    3616kB time=00:00:24.12 bitrate=1228.1kbits/s    
video:2886kB audio:359kB subtitle:0 global headers:0kB muxing overhead 11.412771%
[libx264 @ 0x7f87e214fe00] frame I:21    Avg QP:21.60  size: 87666
[libx264 @ 0x7f87e214fe00] frame P:259   Avg QP:24.97  size:  4221
[libx264 @ 0x7f87e214fe00] frame B:325   Avg QP:27.97  size:    65
[libx264 @ 0x7f87e214fe00] consecutive B-frames: 27.8%  1.0%  2.5% 68.8%
[libx264 @ 0x7f87e214fe00] mb I  I16..4: 55.4%  0.0% 44.6%
[libx264 @ 0x7f87e214fe00] mb P  I16..4:  4.8%  0.0%  1.1%  P16..4: 17.7%  3.0%  0.6%  0.0%  0.0%    skip:72.8%
[libx264 @ 0x7f87e214fe00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.3%  0.1%  0.0%  direct: 0.1%  skip:99.4%  L0:38.8% L1:35.8% BI:25.4%
[libx264 @ 0x7f87e214fe00] coded y,uvDC,uvAC intra: 57.0% 8.3% 0.3% inter: 4.2% 2.3% 0.1%
[libx264 @ 0x7f87e214fe00] i16 v,h,dc,p: 57% 16% 22%  5%
[libx264 @ 0x7f87e214fe00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 21% 18%  5% 10%  7%  5%  4% 10%
[libx264 @ 0x7f87e214fe00] i8c dc,h,v,p: 92%  3%  6%  0%
[libx264 @ 0x7f87e214fe00] Weighted P-Frames: Y:13.1% UV:2.7%
[libx264 @ 0x7f87e214fe00] kb/s:977.06
 



More information about the ffmpeg-user mailing list