[FFmpeg-user] audio is out of sync and "ALSA buffer xrun"
YuGiOhJCJ Mailing-List
yugiohjcj-mailinglist at laposte.net
Sat Feb 22 22:26:39 CET 2014
Sorry I was wrong.
In fact, I need to firstly run ffmpeg, then I watch the content of the /proc/asound/card0/pcm0c/sub0/hw_params file.
So, this is what I have done on a first terminal:
$ ffmpeg -y -f alsa -i default -f x11grab -r 10 -s 640x480 -async 1 -i :0.0 -strict -2 -c:a aac -c:v libx264 -pix_fmt yuv420p -preset ultrafast -s 640x480 -threads 0 -ar 44100 -b:a 64k -b:v 64k -bufsize 64k -f flv "rtmp://live-fra.twitch.tv/app/`cat ~/twitch.key`"
And this is what I have done on a second terminal:
$ cat /proc/asound/card0/pcm0c/sub0/hw_params
access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 1024
buffer_size: 16384
So, 16384/48000 = 0.34 (mine value is smaller than your value).
Indeed, the ping on live-fra.twitch.tv is not possible.
So, I have tested with tcpdump:
$ sudo tcpdump -ni eth0 host live-fra.twitch.tv
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
22:21:12.644355 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [S], seq 2241789542, win 14600, options [mss 1460,sackOK,TS val 37145446 ecr 0,nop,wscale 7], length 0
22:21:12.695150 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [S.], seq 2043124064, ack 2241789543, win 5792, options [mss 1436,sackOK,TS val 1662742014 ecr 37145446,nop,wscale 9], length 0
22:21:12.695178 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], ack 1, win 115, options [nop,nop,TS val 37145497 ecr 1662742014], length 0
22:21:12.695386 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], seq 1:1425, ack 1, win 115, options [nop,nop,TS val 37145498 ecr 1662742014], length 1424
22:21:12.695439 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 1425:1538, ack 1, win 115, options [nop,nop,TS val 37145498 ecr 1662742014], length 113
22:21:12.757727 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 1425, win 17, options [nop,nop,TS val 1662742020 ecr 37145498], length 0
22:21:12.759387 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 1538, win 17, options [nop,nop,TS val 1662742020 ecr 37145498], length 0
22:21:13.120657 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], seq 1:1425, ack 1538, win 17, options [nop,nop,TS val 1662742056 ecr 37145498], length 1424
22:21:13.120676 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], ack 1425, win 137, options [nop,nop,TS val 37145923 ecr 1662742056], length 0
22:21:13.122851 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [P.], seq 1425:3074, ack 1538, win 17, options [nop,nop,TS val 1662742056 ecr 37145498], length 1649
22:21:13.122861 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], ack 3074, win 163, options [nop,nop,TS val 37145925 ecr 1662742056], length 0
22:21:13.122886 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], seq 1538:2962, ack 3074, win 163, options [nop,nop,TS val 37145925 ecr 1662742056], length 1424
22:21:13.122891 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 2962:3074, ack 3074, win 163, options [nop,nop,TS val 37145925 ecr 1662742056], length 112
22:21:13.186668 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 2962, win 23, options [nop,nop,TS val 1662742063 ecr 37145925], length 0
22:21:13.187108 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 3074, win 23, options [nop,nop,TS val 1662742063 ecr 37145925], length 0
22:21:13.187120 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 3074:3233, ack 3074, win 163, options [nop,nop,TS val 37145989 ecr 1662742063], length 159
22:21:13.238634 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 3233, win 29, options [nop,nop,TS val 1662742068 ecr 37145989], length 0
22:21:13.428350 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [P.], seq 3074:3414, ack 3233, win 29, options [nop,nop,TS val 1662742087 ecr 37145989], length 340
22:21:13.428512 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 3233:3245, ack 3414, win 185, options [nop,nop,TS val 37146231 ecr 1662742087], length 12
22:21:13.479104 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 3245, win 29, options [nop,nop,TS val 1662742092 ecr 37146231], length 0
22:21:13.479122 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 3245:3440, ack 3414, win 185, options [nop,nop,TS val 37146281 ecr 1662742092], length 195
22:21:13.531599 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 3440, win 34, options [nop,nop,TS val 1662742097 ecr 37146281], length 0
22:21:13.720507 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [P.], seq 3414:3643, ack 3440, win 34, options [nop,nop,TS val 1662742116 ecr 37146281], length 229
22:21:13.720645 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 3440:3452, ack 3643, win 207, options [nop,nop,TS val 37146523 ecr 1662742116], length 12
22:21:13.769840 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 3452, win 34, options [nop,nop,TS val 1662742121 ecr 37146523], length 0
22:21:13.769858 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 3452:3526, ack 3643, win 207, options [nop,nop,TS val 37146572 ecr 1662742121], length 74
22:21:13.820389 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 3526, win 34, options [nop,nop,TS val 1662742126 ecr 37146572], length 0
22:21:14.376738 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [P.], seq 3643:3661, ack 3526, win 34, options [nop,nop,TS val 1662742182 ecr 37146572], length 18
22:21:14.377239 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [P.], seq 3661:3812, ack 3526, win 34, options [nop,nop,TS val 1662742182 ecr 37146572], length 151
22:21:14.377272 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], ack 3812, win 230, options [nop,nop,TS val 37147179 ecr 1662742182], length 0
22:21:14.479079 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 3526:3538, ack 3812, win 230, options [nop,nop,TS val 37147281 ecr 1662742182], length 12
22:21:14.479876 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], seq 3538:4962, ack 3812, win 230, options [nop,nop,TS val 37147282 ecr 1662742182], length 1424
22:21:14.479955 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], seq 4962:6386, ack 3812, win 230, options [nop,nop,TS val 37147282 ecr 1662742182], length 1424
22:21:14.480013 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], seq 6386:7810, ack 3812, win 230, options [nop,nop,TS val 37147282 ecr 1662742182], length 1424
22:21:14.503009 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], seq 7810:9234, ack 3812, win 230, options [nop,nop,TS val 37147305 ecr 1662742182], length 1424
22:21:14.529153 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 3538, win 34, options [nop,nop,TS val 1662742197 ecr 37147281], length 0
22:21:14.529180 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 9234:9982, ack 3812, win 230, options [nop,nop,TS val 37147331 ecr 1662742197], length 748
22:21:14.542926 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 4962, win 40, options [nop,nop,TS val 1662742199 ecr 37147282], length 0
22:21:14.555229 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 6386, win 46, options [nop,nop,TS val 1662742200 ecr 37147282], length 0
22:21:14.568355 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 7810, win 51, options [nop,nop,TS val 1662742201 ecr 37147282], length 0
22:21:14.581640 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 9234, win 57, options [nop,nop,TS val 1662742202 ecr 37147305], length 0
22:21:14.587551 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 9982, win 62, options [nop,nop,TS val 1662742203 ecr 37147331], length 0
22:21:14.587569 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 9982:10524, ack 3812, win 230, options [nop,nop,TS val 37147390 ecr 1662742203], length 542
22:21:14.642760 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 10524, win 68, options [nop,nop,TS val 1662742208 ecr 37147390], length 0
22:21:14.642783 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 10524:10886, ack 3812, win 230, options [nop,nop,TS val 37147445 ecr 1662742208], length 362
22:21:14.696406 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 10886, win 74, options [nop,nop,TS val 1662742214 ecr 37147445], length 0
22:21:14.696430 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 10886:11523, ack 3812, win 230, options [nop,nop,TS val 37147499 ecr 1662742214], length 637
22:21:14.750972 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], seq 11523:12947, ack 3812, win 230, options [nop,nop,TS val 37147553 ecr 1662742214], length 1424
22:21:14.751087 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], seq 12947:14371, ack 3812, win 230, options [nop,nop,TS val 37147553 ecr 1662742214], length 1424
22:21:14.752174 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 11523, win 79, options [nop,nop,TS val 1662742219 ecr 37147499], length 0
22:21:14.752192 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 14371:15191, ack 3812, win 230, options [nop,nop,TS val 37147554 ecr 1662742219], length 820
22:21:14.815181 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 12947, win 85, options [nop,nop,TS val 1662742226 ecr 37147553], length 0
22:21:14.822662 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], seq 15191:16615, ack 3812, win 230, options [nop,nop,TS val 37147625 ecr 1662742226], length 1424
22:21:14.825566 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 14371, win 90, options [nop,nop,TS val 1662742227 ecr 37147553], length 0
22:21:14.834446 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 15191, win 96, options [nop,nop,TS val 1662742228 ecr 37147554], length 0
22:21:14.834466 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 16615:17456, ack 3812, win 230, options [nop,nop,TS val 37147637 ecr 1662742228], length 841
22:21:14.884980 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 16615, win 102, options [nop,nop,TS val 1662742233 ecr 37147625], length 0
22:21:14.893509 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 17456, win 107, options [nop,nop,TS val 1662742234 ecr 37147637], length 0
22:21:14.893540 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 17456:18418, ack 3812, win 230, options [nop,nop,TS val 37147696 ecr 1662742234], length 962
22:21:14.952716 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 18418, win 113, options [nop,nop,TS val 1662742240 ecr 37147696], length 0
22:21:14.952738 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 18418:18867, ack 3812, win 230, options [nop,nop,TS val 37147755 ecr 1662742240], length 449
22:21:15.006909 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 18867, win 118, options [nop,nop,TS val 1662742245 ecr 37147755], length 0
22:21:15.006935 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 18867:19687, ack 3812, win 230, options [nop,nop,TS val 37147809 ecr 1662742245], length 820
22:21:15.063867 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 19687, win 124, options [nop,nop,TS val 1662742251 ecr 37147809], length 0
22:21:15.063891 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 19687:20408, ack 3812, win 230, options [nop,nop,TS val 37147866 ecr 1662742251], length 721
22:21:15.120557 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 20408, win 126, options [nop,nop,TS val 1662742256 ecr 37147866], length 0
22:21:15.120580 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 20408:20896, ack 3812, win 230, options [nop,nop,TS val 37147923 ecr 1662742256], length 488
22:21:15.174701 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 20896, win 126, options [nop,nop,TS val 1662742262 ecr 37147923], length 0
22:21:15.208000 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 20896:20904, ack 3812, win 230, options [nop,nop,TS val 37148010 ecr 1662742262], length 8
22:21:15.258457 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 20904, win 126, options [nop,nop,TS val 1662742270 ecr 37148010], length 0
22:21:15.258480 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 20904:21924, ack 3812, win 230, options [nop,nop,TS val 37148061 ecr 1662742270], length 1020
22:21:15.317611 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 21924, win 126, options [nop,nop,TS val 1662742276 ecr 37148061], length 0
22:21:15.317635 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 21924:23184, ack 3812, win 230, options [nop,nop,TS val 37148120 ecr 1662742276], length 1260
22:21:15.378962 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 23184, win 126, options [nop,nop,TS val 1662742282 ecr 37148120], length 0
22:21:15.406632 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 23184:23192, ack 3812, win 230, options [nop,nop,TS val 37148209 ecr 1662742282], length 8
22:21:15.457324 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 23192, win 126, options [nop,nop,TS val 1662742290 ecr 37148209], length 0
22:21:15.457349 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 23192:24478, ack 3812, win 230, options [nop,nop,TS val 37148259 ecr 1662742290], length 1286
22:21:15.518648 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 24478, win 126, options [nop,nop,TS val 1662742296 ecr 37148259], length 0
22:21:15.518671 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 24478:25845, ack 3812, win 230, options [nop,nop,TS val 37148321 ecr 1662742296], length 1367
22:21:15.581263 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 25845, win 126, options [nop,nop,TS val 1662742302 ecr 37148321], length 0
22:21:15.606279 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 25845:25853, ack 3812, win 230, options [nop,nop,TS val 37148408 ecr 1662742302], length 8
22:21:15.656219 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 25853, win 126, options [nop,nop,TS val 1662742310 ecr 37148408], length 0
22:21:15.656241 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 25853:26782, ack 3812, win 230, options [nop,nop,TS val 37148458 ecr 1662742310], length 929
22:21:15.706905 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [.], seq 26782:28206, ack 3812, win 230, options [nop,nop,TS val 37148509 ecr 1662742310], length 1424
22:21:15.714573 IP 199.9.254.236.1935 > 192.168.0.2.42053: Flags [.], ack 26782, win 126, options [nop,nop,TS val 1662742316 ecr 37148458], length 0
22:21:15.714593 IP 192.168.0.2.42053 > 199.9.254.236.1935: Flags [P.], seq 28206:28277, ack 3812, win 230, options [nop,nop,TS val 37148517 ecr 1662742316], length 71
^C
86 packets captured
92 packets received by filter
0 packets dropped by kernel
Do you see the RTT value here?
On Fri, 21 Feb 2014 14:35:43 +0100
YuGiOhJCJ Mailing-List <yugiohjcj-mailinglist at laposte.net> wrote:
> I have recompiled my kernel.
> Now, I have this:
> $ cat /proc/asound/card0/pcm0c/sub0/hw_params
> closed
>
> What it means, please?
>
> On Tue, 18 Feb 2014 17:02:37 +0000
> LANGLOIS Olivier PIS -EXT <olivier.pis.langlois at transport.alstom.com> wrote:
>
> > If you want to have them, you need to recompile the kernel with this setting:
> >
> > lano1106 at hpmini ~/dev/linux-ck/src/linux-3.12 $ zgrep SND_VERBOSE /proc/config.gz
> > CONFIG_SND_VERBOSE_PROCFS=y
> > # CONFIG_SND_VERBOSE_PRINTK is not set
> >
> > You can use my numbers, it should give you some idea:
> >
> > lano1106 at hpmini /proc/asound/card0/pcm0c/sub0 $ cat hw_params
> > access: RW_INTERLEAVED
> > format: S16_LE
> > subformat: STD
> > channels: 2
> > rate: 44100 (44100/1)
> > period_size: 11025
> > buffer_size: 22050
> >
> > 22050/44100 = 0.5 (yours could be smaller)
> >
> > http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/rtmp/pdf/rtmp_specification_1.0.pdf
> >
> > The rtmp handshake has 3 messages exchanges.
> >
> > take the rtt from 'ping live-fra.twitch.tv', multiply by 3 and this value must be smaller than 0.5 or whatever you buffer_time is.
> >
> > this server doesn't seem to reply to ICMP echo request so you can get some timing insight by recording your rtmp exchange with wireshark something like that.
> >
> >
> > > -----Original Message-----
> > > From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
> > > bounces at ffmpeg.org] On Behalf Of YuGiOhJCJ Mailing-List
> > > Sent: Tuesday, February 18, 2014 11:44 AM
> > > To: FFmpeg user questions
> > > Subject: Re: [FFmpeg-user] audio is out of sync and "ALSA buffer xrun"
> > >
> > > It seems I have not the same file hierarchy than you in this folder:
> > > $ ls -l /proc/asound/card0/
> > > total 0
> > > -r--r--r-- 1 root root 0 Feb 18 17:42 codec#0
> > > -r--r--r-- 1 root root 0 Feb 18 17:42 id
> > >
> >
> >
> > ________________________________
> > CONFIDENTIALITY : This e-mail and any attachments are confidential and may be privileged. If you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose or store or copy the information in any medium.
> > _______________________________________________
> > ffmpeg-user mailing list
> > ffmpeg-user at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
More information about the ffmpeg-user
mailing list