<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 26, 2013 at 8:16 AM, F. Medeiros <span dir="ltr"><<a href="mailto:excalibas@gmail.com" target="_blank">excalibas@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Hello,<br>
      <br>
      I have the same problem, audio and video are not in sync and  the
      data is not aligned Warning.<br>
      This also happens when using Xephyr.<br>
      <br>
      <br>
      This is what I get from ffmpeg:<br>
      <br>
      x@space:~/Documents/ffmpeg$ ./ffmpeg -fflags +genpts+igndts -f
      x11grab -vsync 0 -r 30 -s 1920x1080 -i :1.0+0,0 -vcodec h264 -f
      jack -ac 2 -r:a 48000  -i screencast -acodec pcm_s16le -r:v 30
      -vsync 2 -async 1 -map 0:0,1,0 -map 1:0 -preset ultrafast -qp 0
      test.mkv<br>
      ffmpeg version N-56669-g1906e00 Copyright (c) 2000-2013 the FFmpeg
      developers<br>
        built on Sep 26 2013 11:48:30 with gcc 4.6 (Ubuntu/Linaro
      4.6.3-1ubuntu5)<br>
        configuration: --enable-libvorbis --enable-gpl --enable-libx264
      --enable-x11grab<br>
        libavutil      52. 46.100 / 52. 46.100<br>
        libavcodec     55. 33.100 / 55. 33.100<br>
        libavformat    55. 18.102 / 55. 18.102<div class="im"><br>
        libavdevice    55.  3.100 / 55.  3.100<br></div>
        libavfilter     3. 87.100 /  3. 87.100<br>
        libswscale      2.  5.100 /  2.  5.100<div class="im"><br>
        libswresample   0. <a href="tel:17.103%20%2F%C2%A0%200.%2017.103" value="+17103017103" target="_blank">17.103 /  0. 17.103</a><br>
        libpostproc    52.  3.100 / 52.  3.100<br></div>
      [x11grab @ 0x917dfc0] device: :1.0+0,0 -> display: :1.0 x: 0 y:
      0 width: 1920 height: 1080<br>
      [x11grab @ 0x917dfc0] shared memory extension found<br>
      Input #0, x11grab, from ':1.0+0,0':<br>
        Duration: N/A, start: 1380208288.085940, bitrate: 1990656 kb/s<br>
          Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0,
      1920x1080, 1990656 kb/s, 30 tbr, 1000k tbn, 30 tbc<div class="im"><br>
      jack_port_get_latency_range called with an incorrect port 0<br></div>
      [jack @ 0x918e260] JACK client registered and activated
      (rate=48000Hz, buffer_size=256 frames)<div class="im"><br>
      Guessed Channel Layout for  Input Stream #1.0 : stereo<br>
      Input #1, jack, from 'screencast':<br></div>
        Duration: N/A, start: 1380144319.409428, bitrate: 3072 kb/s<div class="im"><br>
          Stream #1:0: Audio: pcm_f32le, 48000 Hz, stereo, flt, 3072
      kb/s<br></div>
      [swscaler @ 0x9171fc0] deprecated pixel format used, make sure you
      did set range correctly<div class="im"><br>
      No pixel format specified, yuv444p for H.264 encoding chosen.<br>
      Use -pix_fmt yuv420p for compatibility with outdated media
      players.<br>
      -async is forwarded to lavfi similarly to -af
      aresample=async=1:min_hard_comp=0.100000:first_pts=0.<br></div>
      [libx264 @ 0x95e97c0] using cpu capabilities: MMX2 SSE2Fast SSSE3
      FastShuffle SSE4.2<br>
      [libx264 @ 0x95e97c0] profile High 4:4:4 Predictive, level 4.0,
      4:4:4 8-bit<br>
      [libx264 @ 0x95e97c0] 64 - core 120 r2151 a3f4407 - H.264/MPEG-4
      AVC codec - Copyleft 2003-2011 - <a href="http://www.videolan.org/x264.html" target="_blank">http://www.videolan.org/x264.html</a>
      - 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=6
      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=0 intra_refresh=0 rc=cqp mbtree=0 qp=0<br>
      Output #0, matroska, to 'test.mkv':<br>
        Metadata:<br>
          encoder         : Lavf55.18.102<br>
          Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248),
      yuv444p, 1920x1080, q=-1--1, 1k tbn, 30 tbc<div class="im"><br>
          Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000
      Hz, stereo, s16, 1536 kb/s<br>
      Stream mapping:<br>
        Stream #0:0 -> #0:0 (rawvideo -> libx264)<br>
        Stream #1:0 -> #0:1 (pcm_f32le -> pcm_s16le)<br>
      Press [q] to stop, [?] for help<br></div>
      [swscaler @ 0x9171fc0] Warning: data is not aligned! This can lead
      to a speedloss<br>
      frame=   76 fps= 30 q=-1.0 Lsize=    1218kB time=00:00:02.53
      bitrate=3939.6kbits/s    <br>
      video:745kB audio:469kB subtitle:0 global headers:0kB muxing
      overhead 0.358030%<br>
      [libx264 @ 0x95e97c0] frame I:1     Avg QP: 0.00  size:  7840<br>
      [libx264 @ 0x95e97c0] frame P:75    Avg QP: 0.00  size: 10057<br>
      [libx264 @ 0x95e97c0] mb I  I16..4: 100.0%  0.0%  0.0%<br>
      [libx264 @ 0x95e97c0] mb P  I16..4: 98.5%  0.0%  0.0%  P16..4: 
      0.0%  0.0%  0.0%  0.0%  0.0%    skip: 1.5%<br>
      [libx264 @ 0x95e97c0] coded y,u,v intra: 0.0% 0.0% 0.0% inter:
      0.0% 0.0% 0.0%<br>
      [libx264 @ 0x95e97c0] i16 v,h,dc,p: 100%  0%  0%  0%<br>
      [libx264 @ 0x95e97c0] kb/s:2406.68<br>
      x@space:~/Documents/ffmpeg$ <br><div><div class="h5">
      <br>
      <br>
      On 08/12/2013 03:18 AM, J. Liles wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <br>
          <div class="gmail_quote">On Sun, Aug 11, 2013 at 6:18 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">2013/8/8
              J. Liles <<a href="mailto:malnourite@gmail.com" target="_blank">malnourite@gmail.com</a>><br>
              <div>
                <div>><br>
                  ><br>
                  > As some of you may recall, every time I've posted
                  a demo video to LAD, I've had to include a disclaimer
                  excusing the poor quality due to a lack of functional
                  screencasting tools.<br>
                  ><br>
                  > Well, it took a couple of weeks of hair pulling
                  and many, many hours of testing, but I finally arrived
                  at a solution.<br>
                  ><br>
                  > Anyone who wants to create a screencast and
                  record audio via JACK *in perfect sync* must do the
                  following:<br>
                  ><br>
                  > Get ffmpeg. Apply this patch to it:<br>
                  ><br>
                  > <a href="https://github.com/original-male/FFmpeg/commit/d02509d04d396a98646ca81e9ba327a501486130.patch" target="_blank">https://github.com/original-male/FFmpeg/commit/d02509d04d396a98646ca81e9ba327a501486130.patch</a><br>

                  ><br>
                  > Build it with vorbis and h264 support.<br>
                  ><br>
                  > Then, start your favorite desktop environment. I
                  use Xephyr for this.<br>
                  ><br>
                  > Have jack running (at -r 48000)<br>
                  ><br>
                  > Then run the following command:<br>
                  ><br>
                  > ffmpeg -fflags +genpts+igndts -f x11grab -vsync 0
                  -r 30 -s 1920x1080 -i :${DISPLAY}.+0,0 -vcodec h264 -f
                  jack -ac 2 -r:a 48000  -i screencast -acodec pcm_s16le
                  -r:v 30 -vsync 2 -async 1 -map 0:0,1,0 -map 1:0
                  -preset ultrafast -qp 0 "$FILE"<br>
                  ><br>
                  > Where DISPLAY is the number of your X11 display
                  and FILE is the filename for the screencast. I use a
                  .mkv extension for the matroska container.<br>
                  ><br>
                  > Remember to connect the streams you want recorded
                  to the 'screencast' JACK inputs!<br>
                  ><br>
                  > With this setup I'm able to record a full 30 FPS
                  @ 1080P with audio in perfect sync. Please share your
                  results too. With some more evidence I might have a
                  good case to get ffmpeg to accept my patch.<br>
                  ><br>
                  > Enjoy!<br>
                  ><br>
                  ><br>
                  ><br>
                  ><br>
                  ><br>
                  ><br>
                  ><br>
                </div>
              </div>
              <div>>
                _______________________________________________<br>
                > Linux-audio-dev mailing list<br>
                > <a href="mailto:Linux-audio-dev@lists.linuxaudio.org" target="_blank">Linux-audio-dev@lists.linuxaudio.org</a><br>
                > <a href="http://lists.linuxaudio.org/listinfo/linux-audio-dev" target="_blank">http://lists.linuxaudio.org/listinfo/linux-audio-dev</a><br>
                ><br>
                <br>
              </div>
              My result:<br>
              <br>
              - I had to change screen size to 1366x768 according to my
              laptop display<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>
              <br>
              This is the full log.<br>
              Thank you very much!<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>
              <div>screencast -acodec pcm_s16le -r:v 30
                -vsync 2 -async 1 -map 0:0,1,0<br>
              </div>
              -map 1:0 -preset ultrafast -qp 0 aaa.mkv<br>
              ffmpeg version N-55422-gb37ff48 Copyright (c) 2000-2013
              the FFmpeg developers<br>
                built on Aug 10 2013 10:54:00 with gcc 4.6
              (Ubuntu/Linaro 4.6.3-1ubuntu5)<br>
                configuration: --enable-libx264 --enable-x11grab
              --enable-gpl<br>
              --enable-libvorbis --disable-yasm<br>
                libavutil      52. 41.100 / 52. 41.100<br>
                libavcodec     55. 24.100 / 55. 24.100<br>
                libavformat    55. 13.102 / 55. 13.102<br>
                libavdevice    55.  3.100 / 55.  3.100<br>
                libavfilter     3. 82.100 /  3. 82.100<br>
                libswscale      2.  4.100 /  2.  4.100<br>
                libswresample   0. <a href="tel:17.103%20%2F%20%C2%A00.%2017.103" value="+17103017103" target="_blank">17.103 /  0. 17.103</a><br>
                libpostproc    52.  3.100 / 52.  3.100<br>
              [x11grab @ 0x1ae3700] device: :0.0+0,0 -> display: :0.0
              x: 0 y: 0<br>
              width: 1366 height: 768<br>
              [x11grab @ 0x1ae3700] shared memory extension found<br>
              Input #0, x11grab, from ':0.0+0,0':<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] deprecated pixel format used, make
              sure you did<br>
              set range correctly<br>
              No pixel format specified, yuv444p for H.264 encoding
              chosen.<br>
              Use -pix_fmt yuv420p for compatibility with outdated media
              players.<br>
              -async is forwarded to lavfi similarly to -af<br>
              aresample=async=1:min_hard_comp=0.100000:first_pts=0.<br>
              [libx264 @ 0x2b6e520] using cpu capabilities: MMX2
              SSE2Fast SSSE3<br>
              FastShuffle SSE4.1 Cache64<br>
              [libx264 @ 0x2b6e520] profile High 4:4:4 Predictive, level
              3.2, 4:4:4 8-bit<br>
              [libx264 @ 0x2b6e520] 64 - core 120 r2151 a3f4407 -
              H.264/MPEG-4 AVC<br>
              codec - Copyleft 2003-2011 - <a href="http://www.videolan.org/x264.html" target="_blank">http://www.videolan.org/x264.html</a>
              -<br>
              options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia
              subme=0 psy=0<br>
              mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0
              cqm=0<br>
              deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=3<br>
              sliced_threads=0 nr=0 decimate=1 interlaced=0
              bluray_compat=0<br>
              constrained_intra=0 bframes=0 weightp=0 keyint=250
              keyint_min=25<br>
              scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0<br>
              Output #0, matroska, to 'aaa.mkv':<br>
                Metadata:<br>
                  encoder         : Lavf55.13.102<br>
                  Stream #0:0: Video: h264 (libx264) (H264 /
              0x34363248), yuv444p,<br>
              1366x768, q=-1--1, 1k tbn, 30 tbc<br>
                  Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
              48000 Hz,<br>
              stereo, s16, 1536 kb/s<br>
              Stream mapping:<br>
                Stream #0:0 -> #0:0 (rawvideo -> libx264)<br>
                Stream #1:0 -> #0:1 (pcm_f32le -> pcm_s16le)<br>
              Press [q] to stop, [?] for help<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 0.097703%<br>
              [libx264 @ 0x2b6e520] frame I:1     Avg QP: 0.00
               size:596863<br>
              [libx264 @ 0x2b6e520] frame P:121   Avg QP: 0.00  size:
              12324<br>
              [libx264 @ 0x2b6e520] mb I  I16..4: 100.0%  0.0%  0.0%<br>
              [libx264 @ 0x2b6e520] mb P  I16..4:  7.6%  0.0%  0.0%
               P16..4:  0.3%<br>
              0.0%  0.0%  0.0%  0.0%    skip:92.1%<br>
              [libx264 @ 0x2b6e520] coded y,u,v intra: 11.9% 37.1% 37.5%
              inter: 0.2% 0.2% 0.2%<br>
              [libx264 @ 0x2b6e520] i16 v,h,dc,p: 91%  8%  0%  0%<br>
              [libx264 @ 0x2b6e520] kb/s:4107.72<br>
              Received signal 2: terminating.<br>
              diego@ruidosa:~$<br>
              diego@ruidosa:~$<br>
              diego@ruidosa:~$<br>
            </blockquote>
            <div><br>
              <br>
            </div>
            <div>Interesting. If you use Xephyr you can record a virtual
              desktop larger than your actual display (and therefore
              1920x1080), does that avoid the error (and give you better
              results)?<br>
            </div>
          </div>
          <br>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Linux-audio-dev mailing list
<a href="mailto:Linux-audio-dev@lists.linuxaudio.org" target="_blank">Linux-audio-dev@lists.linuxaudio.org</a>
<a href="http://lists.linuxaudio.org/listinfo/linux-audio-dev" target="_blank">http://lists.linuxaudio.org/listinfo/linux-audio-dev</a>
</pre>
    </blockquote>
    </div></div></div></blockquote><div><br> </div><div class="h5"><br> What is the output of jack_lsp -l?<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote></div></div></div>