ffmpeg cuts don't play with vlc / out of sync

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
mtcubix
New Cone
New Cone
Posts: 1
Joined: 19 Apr 2010 19:06

ffmpeg cuts don't play with vlc / out of sync

Postby mtcubix » 22 Apr 2010 20:01

I have a lot of HD video footage (1920x1080) grabed from the TNT and i wish to keep only the interesting parts and throw the remainder. video is in .ts container.

for this purpose, i tried first to use mencoder, but it revealed quickly inaccurate. The commands -ss <start_time> -endpos <duration> can't handle correctly .ts format as mplayer cannot seek accurately in video .ts.

i tried to do the same job with vlc, but both with vlc (commande line) and vlc menu (save transcode) whole video is copied, the commands --start-time and --stop-time have no effects.

so i'm cutting .ts with command like this :

Code: Select all

ffmpeg -async <n> -y -i input.ts -ss <start_time> -t <duration> -vcodec copy -acodec copy -copyts output.ex
where
n=1, or any positive number.
ex=container abbreviation : avi, mov, mp4 , mkv or ts.

unfortunately, this operation has some bad side-effects:
1-(avi, mov, mp4 ):in 90% cases, loss of A-V sync up to 2-3 seconds desynchronisation.
2- ( mkv ) sound are not playable with mplayer nor movist. files stay in sync with vlc, but play in a strange manner, the same frames already displayed appear a few time after (i think to stay in sync).
3- (ts) files are in perfect sync in all cases, but with a huge inconvenient :
- not playable with vlc up to vlc1.1 (playable only with mplayer and movist )
- an enormous overhead: about 42% with ffmpeg O.51 , 32% with ffmpeg 0.50 , 36% ffmpeg-devel@19824 (all compiled with macports)


conclusion 1 : .ts sync algorithm is very robust as i saw no case of sync loss.

Question 1 : is there any hope to see vlc commands --start-time/ --stop-time doing the right job on macosx ?
Question 2 : have anyone experienced this issue : file .ts produced with ffmpeg has very huge overhead and doesn't play in vlc whatever the version ?
question 3 : how to correct this?

thanks a lot for any help.

here are some tests and results of cutting
---------------------------------------------------------+++++++++++++++++++++++
---------------------------------------------------------+++++++++++++++++++++++
FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --prefix=/opt/local --disable-vhook --enable-gpl
--enable-postproc --enable-swscale --enable-avfilter --enable-avfilter-lavf
--enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libdirac
--enable-libschroedinger --enable-libfaac --enable-libfaad --enable-libxvid
--enable-libx264 --enable-nonfree --mandir=/opt/local/share/man --enable-shared
--enable-pthreads --cc=/usr/bin/gcc-4.2 --arch=x86_64 --enable-libspeex
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 1. 4. 0 / 1. 4. 0
libswscale 1. 7. 1 / 1. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Apr 22 2010 17:03:00, gcc: 4.2.1 (Apple Inc. build 5659)

Seems stream 1 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (50/2)
Input #0, mpegts, from '/Volumes/Imac/ST/saison3/originaux-ts/Sfile-A.ts':
Duration: 01:39:58.05, start: 1807.290300, bitrate: 4786 kb/s
Program 1
Stream #0.0[0x44](fra): Audio: aac, 48000 Hz, stereo, s16, 120 kb/s
Stream #0.1[0x45]: Video: h264, yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], 25 tbr, 90k tbn, 50 tbc
Output #0, mp4, to '/Volumes/Imac/ST/sync-test/extrait-Sfile-A.mp4':
Stream #0.0: Video: libx264, yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], q=2-31, 90k tbn, 25 tbc
Stream #0.1(fra): Audio: libfaac, 48000 Hz, stereo, s16, 120 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Press [q] to stop encoding
frame= 0 fps= 0 q=-1.0 size= 0kB time=10000000000.00 bitrate= 0.0kbi
frame= 0 fps= 0 q=-1.0 size= 0kB time=10000000000.00 bitrate= 0.0kbi
frame= 0 fps= 0 q=-1.0 size= 0kB time=10000000000.00 bitrate= 0.0kbi
[NULL @ 0x101812c00]non-existing PPS referenced
frame= 4713 fps=1017 q=-1.0 size= 106499kB time=388.66 bitrate=2244.7kbits/s
frame= 5530 fps=1061 q=-1.0 size= 125031kB time=421.34 bitrate=2430.9kbits/s
frame= 6368 fps=1115 q=-1.0 size= 143851kB time=454.86 bitrate=2590.7kbits/s
frame= 7192 fps=1157 q=-1.0 size= 162474kB time=487.81 bitrate=2728.5kbits/s
frame= 7979 fps=1181 q=-1.0 size= 180286kB time=519.30 bitrate=2844.0kbits/s
frame= 8778 fps=1199 q=-1.0 size= 198281kB time=551.24 bitrate=2946.7kbits/s
frame= 9783 fps=1250 q=-1.0 size= 221027kB time=591.44 bitrate=3061.4kbits/s
frame=10617 fps=1269 q=-1.0 size= 239826kB time=624.80 bitrate=3144.4kbits/s
frame=11577 fps=1306 q=-1.0 size= 261594kB time=663.20 bitrate=3231.3kbits/s
frame=12328 fps=1312 q=-1.0 size= 278547kB time=693.24 bitrate=3291.6kbits/s
frame=13112 fps=1307 q=-1.0 size= 296253kB time=724.60 bitrate=3349.3kbits/s
frame=13989 fps=1328 q=-1.0 size= 315966kB time=759.68 bitrate=3407.2kbits/s
frame=14952 fps=1351 q=-1.0 size= 337825kB time=798.20 bitrate=3467.1kbits/s
frame=15000 fps=1354 q=-1.0 Lsize= 339239kB time=800.12 bitrate=3473.3kbits/s

video:329518kB audio:9374kB global headers:0kB muxing overhead 0.102450%

---------------------------------------------------------------------------------
sync analysis with mplayer : >>>> 7.4 ms (milliseconds)
command used : mplayer -ss 300 -endpos 30 -geometry 256x144 $output 1>$rec
---------------------------------------------------------------------------------
---------------------------------------------------------+++++++++++++++++++++++
---------------------------------------------------------+++++++++++++++++++++++
FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --prefix=/opt/local --disable-vhook --enable-gpl --enable-postproc
--enable-swscale --enable-avfilter --enable-avfilter-lavf --enable-libmp3lame
--enable-libvorbis --enable-libtheora --enable-libdirac --enable-libschroedinger
--enable-libfaac --enable-libfaad --enable-libxvid --enable-libx264 --enable-nonfree
--mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/gcc-4.2
--arch=x86_64 --enable-libspeex
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 1. 4. 0 / 1. 4. 0
libswscale 1. 7. 1 / 1. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Apr 22 2010 17:03:00, gcc: 4.2.1 (Apple Inc. build 5659)

Seems stream 1 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (50/2)
Input #0, mpegts, from '/Volumes/Imac/ST/saison3/originaux-ts/Sfile-A.ts':
Duration: 01:39:58.05, start: 1807.290300, bitrate: 4786 kb/s
Program 1
Stream #0.0[0x44](fra): Audio: aac, 48000 Hz, stereo, s16, 120 kb/s
Stream #0.1[0x45]: Video: h264, yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], 25 tbr, 90k tbn, 50 tbc
Output #0, mpegts, to '/Volumes/Imac/ST/sync-test/extrait-Sfile-A.ts':
Stream #0.0: Video: libx264, yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], q=2-31, 90k tbn, 25 tbc
Stream #0.1(fra): Audio: libfaac, 48000 Hz, stereo, s16, 120 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Press [q] to stop encoding
[mpegts @ 0x101824400]dts < pcr, TS is invalid
Last message repeated 3960 times
[NULL @ 0x101812c00]non-existing PPS referenced
[mpegts @ 0x101824400]dts < pcr, TS is invalid
Last message repeated 16 times
[NULL @ 0x101812c00]non-existing PPS referenced
[mpegts @ 0x101824400]dts < pcr, TS is invalid
Last message repeated 16 times
[NULL @ 0x101812c00]non-existing PPS referenced
[mpegts @ 0x101824400]dts < pcr, TS is invalid
frame= 2216 fps=1982 q=-1.0 size= 71558kB time=288.73 bitrate=2030.3kbits/s
frame= 3550 fps=2155 q=-1.0 size= 114692kB time=342.13 bitrate=2746.2kbits/s
frame= 5194 fps=2419 q=-1.0 size= 167588kB time=407.89 bitrate=3365.8kbits/s
frame= 6351 fps=2388 q=-1.0 size= 204809kB time=454.17 bitrate=3694.2kbits/s
frame= 7872 fps=2327 q=-1.0 size= 253974kB time=515.01 bitrate=4039.8kbits/s
frame= 9403 fps=2421 q=-1.0 size= 303356kB time=576.25 bitrate=4312.5kbits/s
frame=10891 fps=2484 q=-1.0 size= 351443kB time=635.77 bitrate=4528.4kbits/s
frame=12257 fps=2510 q=-1.0 size= 395541kB time=690.40 bitrate=4693.3kbits/s
frame=12951 fps=2370 q=-1.0 size= 417815kB time=718.16 bitrate=4766.0kbits/s
frame=13804 fps=2283 q=-1.0 size= 445360kB time=752.27 bitrate=4849.8kbits/s
frame=15000 fps=2321 q=-1.0 Lsize= 483971kB time=800.12 bitrate=4955.1kbits/s

video:329518kB audio:9374kB global headers:0kB muxing overhead 42.809914%
---------------------------------------------------------
sync analysis with mplayer : >>>> 20.4 ms (milliseconds)
command used : mplayer -ss 300 -endpos 30 -geometry 256x144 $output 1>$rec
---------------------------------------------------------
---------------------------------------------------------+++++++++++++++++++++++
---------------------------------------------------------+++++++++++++++++++++++

FFmpeg version SVN-r19824, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --prefix=/opt/local --enable-nonfree --enable-gpl --enable-postproc
--enable-avfilter --enable-avfilter-lavf --enable-libmp3lame --enable-libvorbis
--enable-libtheora --enable-libdirac --enable-libschroedinger --enable-libfaac
--enable-libfaad --enable-libxvid --enable-libx264 --mandir=/opt/local/share/man
--enable-shared --enable-pthreads --disable-indevs --cc=/usr/bin/gcc-4.2 --arch=x86_64
libavutil 50. 3. 0 / 50. 3. 0
libavcodec 52.35. 0 / 52.35. 0
libavformat 52.38. 0 / 52.38. 0
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1. 5. 0 / 1. 5. 0
libswscale 1. 7. 1 / 1. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Apr 11 2010 23:14:19, gcc: 4.2.1 (Apple Inc. build 5646) (dot 1)

[NULL @ 0x101829600]non-existing SPS 31 referenced in buffering period
[NULL @ 0x101829600]non-existing PPS referenced
[h264 @ 0x101829600]non-existing SPS 31 referenced in buffering period
[h264 @ 0x101829600]B picture before any references, skipping
[h264 @ 0x101829600]decode_slice_header error
[h264 @ 0x101829600]B picture before any references, skipping
[h264 @ 0x101829600]decode_slice_header error
[h264 @ 0x101829600]no frame!
[h264 @ 0x101829600]number of reference frames exceeds max (probably corrupt input), discarding one

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1)
Last message repeated 5 times
Input #0, mpegts, from '/Volumes/Imac/ST/saison3/originaux-ts/Sfile-B.ts':
Duration: 01:45:00.48, start: 70973.278911, bitrate: 4556 kb/s
Program 1
Stream #0.0[0x44]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 25 tbr, 90k tbn, 50 tbc
Stream #0.1[0x101]: Audio: aac, 48000 Hz, 2 channels, s16, 123 kb/s
Output #0, mov, to '/Volumes/Imac/ST/sync-test/extrait-Sfile-B.mov':
Stream #0.0: Video: libx264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], q=2-31, 50 tbn, 25 tbc
Stream #0.1: Audio: aac, 48000 Hz, 2 channels, s16, 123 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1

Press [q] to stop encoding
[NULL @ 0x101829600]non-existing SPS 31 referenced in buffering period
[NULL @ 0x101829600]non-existing PPS referenced

frame= 0 fps= 0 q=-1.0 size= 0kB time=10000000000.00 bitrate= 0.0kbi
frame= 0 fps= 0 q=-1.0 size= 0kB time=10000000000.00 bitrate= 0.0kbi
frame= 2606 fps=1030 q=-1.0 size= 56023kB time=104.06 bitrate=4410.2kbits/s
frame= 3389 fps=1117 q=-1.0 size= 72923kB time=135.34 bitrate=4414.0kbits/s
frame= 3660 fps=1005 q=-1.0 size= 78950kB time=146.35 bitrate=4419.3kbits/s
frame= 4352 fps=1051 q=-1.0 size= 93928kB time=173.93 bitrate=4424.0kbits/s
frame= 5501 fps=1041 q=-1.0 size= 118799kB time=219.95 bitrate=4424.7kbits/s
frame= 6187 fps=1042 q=-1.0 size= 133793kB time=247.55 bitrate=4427.5kbits/s
frame= 7208 fps=1116 q=-1.0 size= 155656kB time=292.48 bitrate=4359.7kbits/s
frame= 8117 fps=1140 q=-1.0 size= 175497kB time=329.02 bitrate=4369.5kbits/s
frame= 9107 fps=1195 q=-1.0 size= 196936kB time=368.60 bitrate=4376.9kbits/s
frame=10005 fps=1225 q=-1.0 size= 216154kB time=404.46 bitrate=4378.0kbits/s
frame=10792 fps=1244 q=-1.0 size= 233060kB time=435.71 bitrate=4381.9kbits/s
frame=11523 fps=1245 q=-1.0 size= 249046kB time=465.15 bitrate=4386.1kbits/s
frame=12629 fps=1263 q=-1.0 size= 272903kB time=509.31 bitrate=4389.5kbits/s
frame=13549 fps=1290 q=-1.0 size= 292707kB time=546.05 bitrate=4391.3kbits/s
frame=14399 fps=1305 q=-1.0 size= 311299kB time=580.22 bitrate=4395.1kbits/s
frame=15000 fps=1319 q=-1.0 Lsize= 324795kB time=604.20 bitrate=4403.7kbits/s

video:315065kB audio:9374kB global headers:0kB muxing overhead 0.109728%
---------------------------------------------------------
sync analysis with mplayer : >>>> 2606.0 ms (milliseconds)
command used : mplayer -ss 300 -endpos 30 -geometry 256x144 $output 1>$rec
---------------------------------------------------------
---------------------------------------------------------+++++++++++++++++++++++
---------------------------------------------------------+++++++++++++++++++++++

FFmpeg version SVN-r19824, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --prefix=/opt/local --enable-nonfree --enable-gpl
--enable-postproc --enable-avfilter --enable-avfilter-lavf --enable-libmp3lame
--enable-libvorbis --enable-libtheora --enable-libdirac --enable-libschroedinger
--enable-libfaac --enable-libfaad --enable-libxvid --enable-libx264
--mandir=/opt/local/share/man --enable-shared --enable-pthreads
--disable-indevs --cc=/usr/bin/gcc-4.2 --arch=x86_64
libavutil 50. 3. 0 / 50. 3. 0
libavcodec 52.35. 0 / 52.35. 0
libavformat 52.38. 0 / 52.38. 0
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1. 5. 0 / 1. 5. 0
libswscale 1. 7. 1 / 1. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Apr 11 2010 23:14:19, gcc: 4.2.1 (Apple Inc. build 5646) (dot 1)
[NULL @ 0x101829600]non-existing SPS 31 referenced in buffering period
[NULL @ 0x101829600]non-existing PPS referenced
[h264 @ 0x101829600]non-existing SPS 31 referenced in buffering period
[h264 @ 0x101829600]B picture before any references, skipping
[h264 @ 0x101829600]decode_slice_header error
[h264 @ 0x101829600]B picture before any references, skipping
[h264 @ 0x101829600]decode_slice_header error
[h264 @ 0x101829600]no frame!
[h264 @ 0x101829600]number of reference frames exceeds max (probably corrupt input), discarding one

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1)
Last message repeated 5 times
Input #0, mpegts, from '/Volumes/Imac/ST/saison3/originaux-ts/Sfile-B.ts':
Duration: 01:45:00.48, start: 70973.278911, bitrate: 4556 kb/s
Program 1
Stream #0.0[0x44]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 25 tbr, 90k tbn, 50 tbc
Stream #0.1[0x101]: Audio: aac, 48000 Hz, 2 channels, s16, 123 kb/s
Output #0, mpegts, to '/Volumes/Imac/ST/sync-test/extrait-Sfile-B.ts':
Stream #0.0: Video: libx264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], q=2-31, 90k tbn, 25 tbc
Stream #0.1: Audio: aac, 48000 Hz, 2 channels, s16, 123 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
[NULL @ 0x101829600]non-existing SPS 31 referenced in buffering period
[NULL @ 0x101829600]non-existing PPS referenced

frame= 0 fps= 0 q=-1.0 size= 1kB time=10000000000.00 bitrate= 0.0kbi
frame= 0 fps= 0 q=-1.0 size= 1kB time=10000000000.00 bitrate= 0.0kbi
[mpegts @ 0x101846800]dts < pcr, TS is invalid
frame= 9358 fps=1017 q=-1.0 size= 276140kB time=378.69 bitrate=5973.6kbits/s
frame= 9912 fps=1021 q=-1.0 size= 292241kB time=400.77 bitrate=5973.6kbits/s
frame=10554 fps=1031 q=-1.0 size= 311325kB time=426.37 bitrate=5981.6kbits/s
frame=11296 fps=1044 q=-1.0 size= 333133kB time=456.00 bitrate=5984.7kbits/s
frame=12124 fps=1055 q=-1.0 size= 357649kB time=489.22 bitrate=5988.9kbits/s
frame=12885 fps=1071 q=-1.0 size= 380030kB time=519.59 bitrate=5991.6kbits/s
frame=13608 fps=1084 q=-1.0 size= 401469kB time=548.63 bitrate=5994.6kbits/s
frame=14322 fps=1095 q=-1.0 size= 422618kB time=577.26 bitrate=5997.5kbits/s
frame=15000 fps=1114 q=-1.0 Lsize= 442804kB time=604.20 bitrate=6003.7kbits/s

video:315065kB audio:9374kB global headers:0kB muxing overhead 36.483219%
---------------------------------------------------------
sync analysis with mplayer : >>>> 10.1 ms (milliseconds)
command used : mplayer -ss 300 -endpos 30 -geometry 256x144 $output 1>$rec *
---------------------------------------------------------
---------------------------------------------------------+++++++++++++++++++++++
---------------------------------------------------------+++++++++++++++++++++++
*display is redirected to file $rec, which give data like this
A: 327.3 V: 329.8 A-V: -2.508 ct: -0.196 0/ 0 2% 1% 0.4% 0 0
A: 327.5 V: 329.8 A-V: -2.378 ct: -0.196 0/ 0 2% 1% 0.4% 0 0
A: 327.6 V: 329.8 A-V: -2.232 ct: -0.196 0/ 0 2% 1% 0.4% 0 0
A: 327.7 V: 329.8 A-V: -2.102 ct: -0.196 0/ 0 2% 1% 0.4% 0 0
A: 327.8 V: 329.8 A-V: -2.061 ct: -0.200 0/ 0 2% 1% 0.4% 0 0
A: 327.9 V: 331.0 A-V: -3.101 ct: -0.200 0/ 0 2% 1% 0.4% 0 0

10.1 is a mean of the A-V desync=sqrt (sum(a-vi)^2/num)

Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 20 guests