[FFmpeg-user] TS is invalid error causes corruption when encoding (newbie)

Graeme Merrall graeme at inetix.com.au
Sun Aug 2 06:44:25 CEST 2009


I've been attempting to do some video conversion for iPhone based on
the info at ioncannon.net but keep hitting an encoding error. There's
nothing I've found in the archives so hoping someone help.

Using svn checkouts of libx264 and ffmpeg. This has happened both on a
PC (ubuntu) and Mac. Have tinkered with async and dts_delta_threshold
to no avail.

What happens is that the video encodes but a couple seconds in to the
encode an error occurs "[mpegts @ 0x1009400]dts < pcr, TS is invalid"
although the encode continues to the end. Playing back the video, the
clip gets corrupted at the point at which the error occurs.  Have
tried breaking the command line down but haven't hit upon the culprit.

ffmpeg -v 10 -y -i ${in_file} -f mpegts -acodec libmp3lame -ar 48000
-ab 64k -s 320x240 -vcodec libx264 -b 128k -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 128k -maxrate 128k -bufsize 128k -rc_eq 'blurCplx^(1-qComp)'
-qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30
-sws_flags spline -async 2 ${out_file}


FFmpeg version SVN-r19557, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-gpl --enable-nonfree --enable-pthreads
--enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libx264
  libavutil     50. 3. 0 / 50. 3. 0
  libavcodec    52.32. 0 / 52.32. 0
  libavformat   52.37. 0 / 52.37. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 7. 1 /  0. 7. 1
  built on Aug  1 2009 16:01:53, gcc: 4.0.1 (Apple Inc. build 5493)
[wmv3 @ 0x1004400]Extra data: 8 bits left, value: 0

Seems stream 1 codec frame rate differs from container frame rate:
1000.00 (1000/1) -> 25.00 (25/1)
Input #0, asf, from 'video.wmv':
  Duration: 00:02:10.65, start: 4.000000, bitrate: 4734 kb/s
    Stream #0.0(eng): Audio: wmav2, 48000 Hz, 2 channels, s16, 160 kb/s
    Stream #0.1(eng): Video: wmv3, yuv420p, 1280x720, 4960 kb/s, 25
tbr, 1k tbn, 1k tbc
[NULL @ 0x1001400]Unknown option 'sws_flags'
[libx264 @ 0x1053e00]using SAR=1/1
[libx264 @ 0x1053e00]using cpu capabilities: MMX2 Cache64
[libx264 @ 0x1053e00]profile Baseline, level 3.0
[wmv3 @ 0x1004400]Extra data: 8 bits left, value: 0
Output #0, mpegts, to 'sample_pre.ts':
    Stream #0.0(eng): Video: libx264, yuv420p, 320x240 [PAR 1:1 DAR
4:3], q=10-51, 128 kb/s, 90k tbn, 25 tbc
    Stream #0.1(eng): Audio: libmp3lame, 48000 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
  Stream #0.1 -> #0.0
  Stream #0.0 -> #0.1
Press [q] to stop encoding
frame=   16 fps=  0 q=38.0 size=       1kB time=0.64 bitrate=
7.0kbits/s dup=0 drop=0
frame=   34 fps= 32 q=38.0 size=       1kB time=1.36 bitrate=
3.3kbits/s dup=0 drop=0
frame=   53 fps= 34 q=36.0 size=       1kB time=2.12 bitrate=
2.1kbits/s dup=0 drop=0
discarding 2038 audio samples
frame=   70 fps= 34 q=35.0 size=       8kB time=0.29 bitrate=
235.0kbits/s dup=0 drop=0
compensating audio timestamp drift:496.000000 compensation:2 in:48000
frame=   87 fps= 33 q=35.0 size=      27kB time=0.82 bitrate=
269.1kbits/s dup=0 drop=0
frame=  104 fps= 33 q=34.0 size=      43kB time=1.32 bitrate=
264.3kbits/s dup=0 drop=0
frame=  121 fps= 33 q=31.0 size=      55kB time=1.82 bitrate=
244.9kbits/s dup=0 drop=0
frame=  139 fps= 34 q=32.0 size=      72kB time=2.35 bitrate=
251.9kbits/s dup=0 drop=0
[mpegts @ 0x1009400]dts < pcr, TS is invalid
compensating audio timestamp drift:494.000000 compensation:2 in:48000
frame=  157 fps= 34 q=32.0 size=      88kB time=2.86 bitrate=
252.2kbits/s dup=0 drop=0
compensating audio timestamp drift:492.000000 compensation:2 in:48000
frame=  175 fps= 34 q=21.0 size=     107kB time=3.41 bitrate=
258.2kbits/s dup=0 drop=0
frame=  194 fps= 34 q=20.0 size=     127kB time=4.01 bitrate=
259.3kbits/s dup=0 drop=0
... trimmed ...
frame=  472 fps= 33 q=38.0 size=     509kB time=16.01 bitrate=
260.7kbits/s dup=0 drop=0
compensating audio timestamp drift:724.000000 compensation:2 in:48000
frame=  492 fps= 33 q=34.0 size=     525kB time=16.51 bitrate=
260.5kbits/s dup=0 drop=0
frame=  512 fps= 33 q=33.0 size=     536kB time=17.06 bitrate=
257.4kbits/s dup=0 drop=0
frame=  529 fps= 33 q=34.0 size=     551kB time=17.54 bitrate=
257.1kbits/s dup=0 drop=0


video:2024kB audio:1034kB global headers:0kB muxing overhead 35.481182%
    Last message repeated 6622 times
[libx264 @ 0x1053e00]slice I:181   Avg QP:31.33  size:  2603
[libx264 @ 0x1053e00]slice P:3125  Avg QP:30.54  size:   511
[libx264 @ 0x1053e00]mb I  I16..4: 74.3%  0.0% 25.7%
[libx264 @ 0x1053e00]mb P  I16..4: 10.7%  0.0%  0.3%  P16..4: 29.5%
5.5%  0.4%  0.0%  0.0%    skip:53.6%
[libx264 @ 0x1053e00]coded y,uvDC,uvAC intra:24.6% 17.2% 2.5%
inter:7.8% 3.1% 0.1%
[libx264 @ 0x1053e00]kb/s:125.1


More information about the ffmpeg-user mailing list