I have a VOB file that I want to convert to h264 using x264. I used:

ffmpeg -i 01.VOB -f mp4  -c:v libx264  -profile:v baseline -crf 17  -c:a toolame -vbr 3  prehratelne.mp4

which gave me this:

Input #0, mpeg, from '01.VOB':
  Duration: 01:22:01.44, start: 0.360000, bitrate: 6395 kb/s
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m/bt470bg/bt470bg), 720x576 [SAR 64:45 DAR 16:9], max. 7700 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
[libx264 @ 0x1567ae0] using SAR=64/45
[libx264 @ 0x1567ae0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x1567ae0] profile Constrained Baseline, level 3.0
[libx264 @ 0x1567ae0] 264 - core 142 r2495 6a301b6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=17.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'a.mp4':
    encoder         : Lavf56.15.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
      encoder         : Lavc56.13.100 libx264
    Stream #0:1: Audio: mp3 (libmp3lame) (i[0][0][0] / 0x0069), 48000 Hz, stereo, fltp
      encoder         : Lavc56.13.100 libmp3lame
Stream mapping:
  Stream #0:1 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:2 -> #0:1 (ac3 (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
frame=  107 fps=0.0 q=22.0 size=     379kB time=00:00:03.91 bitrate= 794.0kbits/frame=  178 fps=178 q=22.0 size=     773kB time=00:00:06.64 bitrate= 952.7kbits/frame=  247 fps=164 q=22.0 size=    1131kB time=00:00:09.45 bitrate= 979.9kbits/frame=  289 fps=139 q=-1.0 Lsize=    1620kB time=00:00:11.56 bitrate=1148.3kbits/s    
video:1569kB audio:45kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.425711%

However, the resulting files have a difference in length and start of about 80 miliseconds:

ffmpeg -i *.VOB 2>&1 | grep Duration
  Duration: 01:22:01.44, start: 0.360000, bitrate: 6395 kb/s
ffmpeg -i prehratelne.mp4 2>&1 | grep Duration
  Duration: 01:22:01.53, start: 0.023021, bitrate: 4737 kb/s

Why is that, can it be somehow fixed? Ideally, I would have files that correspond frame by frame.

  • 2
    I can't tell you what's happening, but I can say that you're never going to get files that match "frame by frame" because neither codec stores individual frames. Instead they store interframe information with a complete keyframe every so often. The exact number and spacing of these will differ between codecs and will vary with the parameters you choose.
    – Jim Mack
    Commented May 15, 2015 at 20:19
  • 1
    Great answer provided by @avnr: video.stackexchange.com/a/15591/10976
    – user10976
    Commented Jun 3, 2015 at 16:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.