<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 12, 2013 at 5:17 AM, Diego Simak <span dir="ltr"><<a href="mailto:diego.simak@gmail.com" target="_blank">diego.simak@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2013/8/12 Peder Hedlund <<a href="mailto:peder@musikhuset.org">peder@musikhuset.org</a>>:<br>
<div><div class="h5">> Quoting Diego Simak <<a href="mailto:diego.simak@gmail.com">diego.simak@gmail.com</a>>:<br>
><br>
>> - Audio and video are not in sync, I can see the following message<br>
>> after executing the ffmpeg command:<br>
>><br>
>> [swscaler @ 0x1ac5080] Warning: data is not aligned! This can lead to<br>
>> a speedloss<br>
>><br>
>> diego@ruidosa:~$ ffmpeg -fflags +genpts+igndts -f x11grab -vsync 0 -r<br>
>> 30 -s 1366x768 -i :0.0+0,0 -vcodec h264 -f jack -ac 2 -r:a 48000  -i<br>
>> screencast -acodec pcm_s16le -r:v 30 -vsync 2 -async 1 -map 0:0,1,0<br>
>> -map 1:0 -preset ultrafast -qp 0 aaa.mkv<br>
><br>
><br>
>>   Duration: N/A, start: 1376226919.464630, bitrate: 1007124 kb/s<br>
>>     Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1366x768,<br>
>> 1007124 kb/s, 30 tbr, 1000k tbn, 30 tbc<br>
>> jack_port_get_latency_range called with an incorrect port 0<br>
>> [jack @ 0x1afbce0] JACK client registered and activated (rate=48000Hz,<br>
>> buffer_size=1024 frames)<br>
>> Guessed Channel Layout for  Input Stream #1.0 : stereo<br>
>> Input #1, jack, from 'screencast':<br>
>>   Duration: N/A, start: 1376226919.619355, bitrate: 3072 kb/s<br>
>>     Stream #1:0: Audio: pcm_f32le, 48000 Hz, stereo, flt, 3072 kb/s<br>
>> [swscaler @ 0x1ac5080] Warning: data is not aligned! This can lead to<br>
>> a speedloss<br>
>> frame=  122 fps= 23 q=-1.0 Lsize=    2774kB time=00:00:04.06<br>
>> bitrate=5588.3kbits/s<br>
>> video:2040kB audio:732kB subtitle:0 global headers:0kB muxing  overhead<br>
>> 0.097703%<br>
><br>
><br>
> A couple of things :<br>
><br>
> * 1366 isn't a multiple of 8 which is probably why you get the "data is not<br>
> aligned! This can lead to a speedloss" warning. Set it to 1360 instead.<br>
><br>
<br>
</div></div>Ok, changing to 1360 and now no speedloss message is observerd.<br>
<div class="im"><br>
> * You've set ffmpeg to record at 30 fps but it seems your computer can only<br>
> manage to do 23 fps. That might be the cause of the A/V being out of sync.<br>
> Either decrease the capture area, change "-r:v 30" to something like "-r:v<br>
> 20" or try doing an uncompressed recording (replace "-vcodec h264 -preset<br>
> ultrafast -qp 0" with something like "-vcodec huffyuv"). In the latter case<br>
> you'll end up with a really big capture file which you might want/need to<br>
> demux, compress and remux afterwards.<br>
><br>
<br>
</div>I've tried both and still the audio is not in sync with the video:<br>
<br>
with -r:v 20<br>
<br>
ffmpeg -fflags +genpts+igndts -f x11grab -vsync 0 -r 30 -s 1360x768 -i<br>
<div class="im">:0.0+0,0 -vcodec h264 -f jack -ac 2 -r:a 48000  -i screencast -acodec<br>
pcm_s16le -r:v 20 -vsync 2 -async 1 -map 0:0,1,0 -map 1:0 -preset<br>
</div>ultrafast -qp 0 toto.mkv<br>
<br>
I get this message every second:<br>
<br>
[libx264 @ 0x2832a00] non-strictly-monotonic PTS<br>
    Last message repeated 2 times<br>
frame=   11 fps=0.0 q=0.0 size=     587kB time=00:00:00.25<br>
bitrate=19235.5kbits/[libx264 @ 0x2832a00] non-strictly-monotonic PTS<br>
    Last message repeated 3 times<br>
frame=   23 fps= 21 q=0.0 size=     804kB time=00:00:00.65<br>
bitrate=10137.9kbits/[libx264 @ 0x2832a00] non-strictly-monotonic PTS<br>
    Last message repeated 3 times<br>
frame=   33 fps= 21 q=0.0 size=    1125kB time=00:00:01.00<br>
bitrate=9220.1kbits/s[libx264 @ 0x2832a00] non-strictly-monotonic PTS<br>
    Last message repeated 2 times<br>
frame=   44 fps= 21 q=0.0 size=    1461kB time=00:00:01.35 bitrate=8866.4kbits/s<br>
<br>
<br>
<br>
<br>
without -r:v 20 and with -vcodec huffyuv<br>
<br>
I get as you said an enormeous file and this message, but this option<br>
seems to be better; e.g: audio is not in sync but better than h264<br>
<br>
Too many video packets in the buffer: (27 in 33747576 bytes).<br>
Maybe you are playing a non-interleaved stream/file or the codec failed?<br>
For AVI files, try to force non-interleaved mode with the -ni option.<br>
A:   8.2 V:   7.8 A-V:  0.461 ct:  0.074   0/  0 97%  3% 69.7% 71 0<br>
<br>
<br>
           ************************************************<br>
           **** Your system is too SLOW to play this!  ****<br>
           ************************************************<br>
<br>
<br>
It's a Core 2 Duo 2.27 GHz CPUs, don't know if its slow or not, seems it is...<br>
<br>
I still have to try what happens with J.Liles suggestion to use Xephyr<br>
but it seems that it will be the same.<br>
<br>
Thanks for your help, really appreciated!<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
>  - Peder<br>
> _______________________________________________<br>
> Linux-audio-user mailing list<br>
> <a href="mailto:Linux-audio-user@lists.linuxaudio.org">Linux-audio-user@lists.linuxaudio.org</a><br>
> <a href="http://lists.linuxaudio.org/listinfo/linux-audio-user" target="_blank">http://lists.linuxaudio.org/listinfo/linux-audio-user</a><br>
_______________________________________________<br>
Linux-audio-user mailing list<br>
<a href="mailto:Linux-audio-user@lists.linuxaudio.org">Linux-audio-user@lists.linuxaudio.org</a><br>
<a href="http://lists.linuxaudio.org/listinfo/linux-audio-user" target="_blank">http://lists.linuxaudio.org/listinfo/linux-audio-user</a><br>
</div></div></blockquote></div><br></div><div class="gmail_extra">Your system may indeed be too slow to play back the resulting video. You should first transcode it to a more highly compressed format:<br><br></div><div class="gmail_extra">
e.g. ffmpeg -i foo.mkv -acodec libvorbis -vcodec h264 bar.mkv<br><br></div></div>