1

I have a video in .ogv and want to convert it to .mp4 so I can upload it to youtube.

I am trying ffmpeg for it:

ffmpeg -i *.ogv -acodec libmp3lame -vcodec libx264 -crf 18 Windup-demo.mp4

After conversion, the video is out of sync - the audio sounds ok, but the video seems to rush. The original video is recorded using RecordMyDesktop, 5 frames per second, audio 48000 samples per second stereo.

What can I try to fix this?

(I am accepting any result that will get the video to YouTube.)

I've tried ffmpeg -r 5 -i Windup-2.5.0-shortDemo-04.ogv -acodec libmp3lame -vcodec h264 -r 5 Windup-demoX.mp4, no success - the sync got even worse.

EDIT: I have tried ffmpeg -r 5 -i Windup-2.5.0-shortDemo-04.ogv -acodec libmp3lame -vcodec libx264 -r 5 -vsync cfr Windup-demoX.mp4 or with vfr but no success.

So the question turns down to "how to force ffmpeg to use the right output framerate.

I have also tried the static build from http://johnvansickle.com/ffmpeg/ . I've tried to encode it back to OGV, using -vcodec libtheora, but that was failing with 'invalid option', didn't figure out what was wrong.

I've also tried ffmpeg -loglevel info -r:v 5 -framerate 5 -i Windup-2.5.0-shortDemo-04.ogv -acodec copy -vcodec h264 -r 15 Windup-demoX.mp4. -framerate should be usable as input parameter, but it says "Option framerate not found.". For output it works.

$ ffmpeg -i Windup-2.5.0-shortDemo-04.ogv -acodec libmp3lame -vcodec libx264 -crf 18 Windup-demoX.mp4
ffmpeg version N-79139-gde1a0d4 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 30.100 / 57. 30.100
  libavformat    57. 29.101 / 57. 29.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 40.102 /  6. 40.102
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.
Input #0, ogg, from 'Windup-2.5.0-shortDemo-04.ogv':
  Duration: 00:06:13.00, start: 0.000000, bitrate: 1134 kb/s
    Stream #0:0: Data: none
    Stream #0:1: Video: theora, yuv420p, 1920x1056 [SAR 1:1 DAR 20:11], 5 tbr, 5 tbn, 5 tbc
    Metadata:
      RECORDMYDESKTOP : 0.3.8.1
    Stream #0:2: Audio: vorbis, 48000 Hz, stereo, fltp, 499 kb/s
[libx264 @ 0x30beec0] using SAR=1/1
[libx264 @ 0x30beec0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x30beec0] profile High, level 4.0
[libx264 @ 0x30beec0] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 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=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'Windup-demoX.mp4':
  Metadata:
    encoder         : Lavf57.29.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1056 [SAR 1:1 DAR 20:11], q=-1--1, 5 fps, 10240 tbn, 5 tbc
    Metadata:
      RECORDMYDESKTOP : 0.3.8.1
      encoder         : Lavc57.30.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: mp3 (libmp3lame) (i[0][0][0] / 0x0069), 48000 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc57.30.100 libmp3lame
Stream mapping:
  Stream #0:1 -> #0:0 (theora (native) -> h264 (libx264))
  Stream #0:2 -> #0:1 (vorbis (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.trate=  55.0kbits/s speed=  35x
[ogg @ 0x30b7d60] Broken file, non-keyframe not correctly marked.
    Last message repeated 3 times
[ogg @ 0x30b7d60] Broken file, non-keyframe not correctly marked.e=  84.6kbits/s dup=18 drop=0 speed=29.4x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 141.2kbits/s dup=46 drop=0 speed=22.5x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 179.3kbits/s dup=50 drop=0 speed=23.3x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 487.8kbits/s dup=51 drop=0 speed=21.4x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 518.6kbits/s dup=55 drop=0 speed=21.2x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 494.7kbits/s dup=93 drop=0 speed=  21x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 457.5kbits/s dup=93 drop=0 speed=21.8x
    Last message repeated 1 times
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 409.8kbits/s dup=93 drop=0 speed=23.2x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 375.2kbits/s dup=93 drop=0 speed=24.2x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 391.1kbits/s dup=124 drop=0 speed=23.2x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 389.7kbits/s dup=147 drop=0 speed=23.1x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 392.5kbits/s dup=193 drop=0 speed=22.5x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 377.9kbits/s dup=195 drop=0 speed=22.8x
    Last message repeated 1 times
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 368.9kbits/s dup=195 drop=0 speed=23.1x
    Last message repeated 1 times
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 355.5kbits/s dup=195 drop=0 speed=23.5x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 404.0kbits/s dup=244 drop=0 speed=22.5x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 392.9kbits/s dup=284 drop=0 speed=22.6x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 378.4kbits/s dup=284 drop=0 speed=22.9x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 371.0kbits/s dup=318 drop=0 speed=  23x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 364.4kbits/s dup=366 drop=0 speed=22.9x
    Last message repeated 1 times
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 351.5kbits/s dup=366 drop=0 speed=23.4x
[ogg @ 0x30b7d60] Broken file, keyframe not correctly marked.itrate= 341.4kbits/s dup=366 drop=0 speed=23.7x
frame= 1026 fps= 63 q=-1.0 Lsize=   16452kB time=00:06:12.51 bitrate= 361.8kbits/s dup=400 drop=0 speed=22.8x
video:10602kB audio:5820kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.180144%
[libx264 @ 0x30beec0] frame I:9     Avg QP: 3.21  size:226053
[libx264 @ 0x30beec0] frame P:317   Avg QP:12.28  size: 26964
[libx264 @ 0x30beec0] frame B:700   Avg QP:17.44  size:   391
[libx264 @ 0x30beec0] consecutive B-frames:  8.3%  1.6%  2.0% 88.1%
[libx264 @ 0x30beec0] mb I  I16..4: 72.1% 10.0% 17.9%
[libx264 @ 0x30beec0] mb P  I16..4:  4.8%  0.4%  1.8%  P16..4:  3.3%  0.7%  0.5%  0.0%  0.0%    skip:88.5%
[libx264 @ 0x30beec0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  1.4%  0.0%  0.0%  direct: 0.1%  skip:98.4%  L0:31.6% L1:67.9% BI: 0.5%
[libx264 @ 0x30beec0] 8x8 transform intra:7.4% inter:68.2%
[libx264 @ 0x30beec0] coded y,uvDC,uvAC intra: 18.2% 26.7% 23.3% inter: 0.5% 1.3% 1.1%
[libx264 @ 0x30beec0] i16 v,h,dc,p: 57% 42%  0%  0%
[libx264 @ 0x30beec0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 21% 51%  1%  1%  1%  1%  1%  2%
[libx264 @ 0x30beec0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 32% 19%  3%  4%  4%  5%  3%  5%
[libx264 @ 0x30beec0] i8c dc,h,v,p: 54% 34% 12%  1%
[libx264 @ 0x30beec0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x30beec0] ref P L0: 83.0%  2.9%  9.8%  4.4%
[libx264 @ 0x30beec0] ref B L0: 83.0% 15.4%  1.5%
[libx264 @ 0x30beec0] ref B L1: 91.9%  8.1%
[libx264 @ 0x30beec0] kb/s:423.23
4
  • 2
    Please show the full console output of the command.
    – Gyan
    Commented May 12, 2016 at 15:06
  • The full console output is quite long. But ok I'm adding it. Commented May 16, 2016 at 20:18
  • Seems like someone had a very similar problem: video.stackexchange.com/questions/5833/… Commented May 16, 2016 at 20:36
  • I am coming to a conclusion that I've made a mistake of using RecordMyDesktop, and setting it to 5 FPS. Commented May 16, 2016 at 21:53

1 Answer 1

0

What I did in the end was a bit ridiculous.

I played the video in VLC, and recorded that again with RecordMyDesktop with 30 FPS and with "full frame every frame" option. This had a terrible audio, but YouTube ate it.

Then I uploaded another version with the desynced video but good audio. Then I used YouTube editor to mix these two together. The result is a bit "visually challenged", but at least I don't have to re-record it.

I'm still accepting anything better.

1
  • A better solution would be to use ffmpeg to record your desktop into MP4 directly.
    – Gyan
    Commented May 17, 2016 at 5:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .