Twitch-Streamer-Linux icon indicating copy to clipboard operation
Twitch-Streamer-Linux copied to clipboard

Audio always out of sync

Open LiamDawe opened this issue 11 years ago • 6 comments
trafficstars

Tried streaming using your scripts on Ubuntu 13.10 and it always puts my audio out of sync.

LiamDawe avatar Apr 01 '14 22:04 LiamDawe

add -async <int seconds> to resync the audio. it's a ffmpeg/avconv problem.

an example: ... -ac 2 -ar $AUDIO_RATE -async 1 -vcodec libx264 ...

please always define the script used.

wargio avatar Apr 02 '14 08:04 wargio

liamdawe looks like there was a strange problem with the -r option. can you try again with the new script?

wargio avatar Apr 26 '14 18:04 wargio

I tried the latest version of the script, and still have sync issues. I think the issue is more complex than it looks.

If I don't use -async, audio on the twitch player will be a bit faster the the source, then go silent. After a while audio playback starts again, and repeats the process. It can happen 2 or 3 times, then the stream will crash.

If I use -async, streaming the desktop is ok, but most games will crash the stream on start with this error :

Non-monotonous timestamps, dropping whole buffer..88 bitrate= 507.5kbits/s    
[flv @ 0x1c47be0] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 5419 >= 5138
av_interleaved_write_frame(): Invalid argument

It really looks like a conflict between 48000Hz pulseaudio output and avconv/libmp3lame 44100Hz output. Somehow, bitrate conversion fails, but i don't know where... The issue makes it impossible for me to stream audio. Video, on the other hand is working perfectly.

Hellzed avatar Jun 09 '14 21:06 Hellzed

install libflac and open the script, then change the codec from libmp3lame to flac and set the frequency to 48000

wargio avatar Jun 09 '14 22:06 wargio

It doesn't seem possible with a 48000Hz samplerate :

[flv @ 0x16e0d20] flv does not support that sample rate, choose from (44100, 22050, 11025).

Hellzed avatar Jun 09 '14 22:06 Hellzed

then the most simple thing you can do is edit the etc/pulse/daemon.conf and set the frequency of pulseaudio to 44100

; default-sample-format = s16le
; default-sample-rate = 44100

PS: you will need to restart the server by writing on the terminal: pulseaudio -k

wargio avatar Jun 10 '14 08:06 wargio