Sorry for the double post.
I have partially fixed the problem. I have the audio in sync but only by decreasing the frame rate from 30 to 24. This will work but is there a reason it didn't work at 30?
Printable View
Please show your ffmpeg command and the complete ffmpeg console output. Does it make a difference if you replace "-r" with "-framerate"?
Thanks for the response! My command:
Also it should be noted that decreasing the fps to 24 did not completely fix the problem... It's 50/50 sometimes it's in sync and sometimes it's not, very odd.Code:ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 24 -s 1920x1080 -i :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 output.mkv
Output:
Code:ffmpeg version git-2013-12-27-42b6805 Copyright (c) 2000-2013 the FFmpeg developers
built on Dec 26 2013 20:44:39 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
configuration: --prefix=/home/apott/ffmpeg_build --extra-cflags=-I/home/apott/ffmpeg_build/include --extra-ldflags=-L/home/apott/ffmpeg_build/lib --bindir=/home/apott/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
libavutil 52. 59.100 / 52. 59.100
libavcodec 55. 46.100 / 55. 46.100
libavformat 55. 22.100 / 55. 22.100
libavdevice 55. 5.102 / 55. 5.102
libavfilter 4. 0.103 / 4. 0.103
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'pulse':
Duration: N/A, start: 1388124885.639449, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[x11grab @ 0x1bf2c20] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1920 height: 1080
[x11grab @ 0x1bf2c20] shared memory extension found
Input #1, x11grab, from ':0.0':
Duration: N/A, start: 1388124885.695288, bitrate: 1592524 kb/s
Stream #1:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 1592524 kb/s, 24 tbr, 1000k tbn, 24 tbc
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x1c09680] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0x1c09680] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit
[libx264 @ 0x1c09680] 264 - core 140 r2 1ca7bb9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=24 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, matroska, to 'output.mkv':
Metadata:
encoder : Lavf55.22.100
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 1920x1080, q=-1--1, 1k tbn, 24 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #1:0 -> #0:0 (rawvideo -> libx264)
Stream #0:0 -> #0:1 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
frame= 129 fps= 24 q=-1.0 Lsize= 2749kB time=00:00:05.37 bitrate=4189.9kbits/s
video:1717kB audio:1003kB subtitle:0 global headers:0kB muxing overhead 1.082968%
[libx264 @ 0x1c09680] frame I:1 Avg QP: 0.00 size:426614
[libx264 @ 0x1c09680] frame P:128 Avg QP: 0.00 size: 10396
[libx264 @ 0x1c09680] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x1c09680] mb P I16..4: 63.8% 0.0% 0.0% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip:36.1%
[libx264 @ 0x1c09680] coded y,u,v intra: 0.3% 0.3% 0.3% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x1c09680] i16 v,h,dc,p: 100% 0% 0% 0%
[libx264 @ 0x1c09680] kb/s:2615.57
It's good you're using a recent and real build of ffmpeg.
1. Have you tried using -framerate instead of -r?
2. What if you capture video and audio as separate processes and remux? (The following is untested)
3. What player are you using so you know it is not in sync?Code:ffmpeg -f x11grab -framerate 24 -video_size 1920x1080 -i :0.0 -vcodec libx264 -preset ultrafast -crf 0 -t 60 v.mkv & \
ffmpeg -f alsa -ac 2 -i pulse -acodec copy -t 60 a.wav && fg; \
ffmpeg -i v.mkv -i a.wav -c copy -shortest muxed.mkv
4. Is it better if you re-encode the original, out-of-sync output?
Code:ffmpeg -i output.mkv -vf scale=640:-1 -crf 18 -preset medium -pix_fmt yuv420p -c:a copy output.mkv
Hello all,
First of all, sorry if the information I'm sharing is not related with the topic.
With some coworkers we are developing a tool to replace Jing for ubuntu. Is free and the source code is in bitbucket https://bitbucket.org/msbrocca/screen-capturer
So far we are just capturing screen parts to save or share. We have an open branch to work on video capturing.
Feel free to take a look and use it.
Regards,
Maxi