Audio issue when streaming to twitch
-
Quick summary: The audio is fine locally when not streaming, but if I do stream the audio goes distorted locally, but not on the stream. This didn't seem to happen until I upgraded my retropie to the latest version.
Pi Model or other hardware: 3b
Power Supply used: 5v 3A
RetroPie Version Used : 4.8
Built From: Pre made SD Image on RetroPie website
USB Devices connected: PS3 Controller
Controller used: PS3 Controller
Error messages received: NoneI managed to get my twitch stream setup working perfectly when running nes and sega genesis/megadrive using the method used here:
https://retropie.org.uk/forum/topic/18303/livestreaming-to-twitch-on-retropie-4-4/6
The only difference was I used 'libshine' as the audio codec in order to get the audio working both locally and on the stream playback. I was using an older version of RetroPie and it was working perfectly, no lag, no audio issues etc.
My 'twitch.cfg' file looks like this:
vcodec = libx264 acodec = libshine pix_fmt = yuv420p threads = 2 scale_factor = 1 format = flv video_preset = ultrafast video_profile = main video_tune = animation video_bufsize = 512k video_minrate = 512k video_maxrate = 512k video_r = 60 video_g = 120 video_keyint_min = 60
After running an update on my Pi, it seemed to mess up my audio. The weird thing is, the audio is fine when not streaming, but if I am streaming, the audio being played out through twitch is fine but the local audio goes horrific, almost like the volume is up at 10000, pure distortion.
Let me know what I can post to help with any diagnosis.
-
Which RetroArch/RetroPie version did you run before the update ?
Can you get a verbose log taken during streaming and post it on pastebin.com ?
-
EDIT - Nes seemed to let me launch with verbose, even using my custom emulator option. I will post to a paste bin asap.
@mitu Thanks for getting back to me so fast.
The emulator selection removes the option to launch with verbose logging.
The line I added to 'emulators.cfg' is as follows:
genesis_plus_gx-record-twitch = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-genesis-plus-gx/genesis_plus_gx_libretro.so --config /opt/retropie/configs/megadrive/retroarch.cfg --recordconfig /home/pi/RetroPie/recording/twitch.cfg --record rtmp://live.
/my key this is hidden --recordconfig /home/pi/RetroPie/recording/twitch.cfg %ROM%"From my limited understanding this launches 'genesis_plus_gx' but with a parameter to then record direct to a twitch stream. Weird though, if I select just the genesis plus gx option in the emulator list instead of my custom one, verbose launch appears ,but obviously this is useless as I need to replicate the problem when streaming!
I cannot remember what the versions were pre-update. I do remember retroarch being old school looking with green type on a dark background however.
Is there anything else I can do to share a log?
-
@mitu verbose log from the nes. I edited out my twitch key for obv reasons.
-
Nothing particular jumps out from the log, doesn't seem to be a mis-configuration.
With the same recording config, I get visible audio artifacts when starting recording (even without streaming), so it seems is RetroArch related. Which RetroPie image version did you use for the installation ? This may help narrow down the version which was working fine and perhaps help track what RetroArch changes may have caused this regression.I cannot remember what the versions were pre-update. I do remember retroarch being old school looking with green type on a dark background however.
That's probably because you've reset to the default RetroArch configuration, instead of using the one added by RetroPie.
-
Ah I see. I am not sure of the original image. Would there be a log file anywhere I could access which details which versions I've had?
It's strange how the feed which is fed to the live stream still has perfect quality while the local one goes to pot. I thought I had cracked it as If I go to the in game retro arch menu, all the audio settings are on 100 volume maxed out, but I've tried modifying these and they don't do anything.
-
@mitu Another bit of troubleshooting. If I edit the 'latency' in the in game retroarch menu, to basically any number then exit the menu, the audio goes back to normal. This seems to either delay the streaming, or pause it completely however.
-
@yooodt said in Audio issue when streaming to twitch:
Ah I see. I am not sure of the original image. Would there be a log file anywhere I could access which details which versions I've had?
Any update is logged in
$HOME/RetroPie-Setup/logs
, you can take a look at the last update logs and it should show the RetroPie version at the beginning of the log file. -
@mitu at the top of the log:
RetroPie-Setup version: 4.8.2 (b11c10a0)
System: rpi3 (armv7l) - Raspbian GNU/Linux 10 (buster) - Linux retropie 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux
Update is available - updating ...What do you think about when I changed the 'audio latency' in the in-game retroarch menu, the sound goes perfect. If I refresh my twitch stream it seems like it actually keeps working.
Is this a good clue I wonder?!
-
@yooodt said in Audio issue when streaming to twitch:
RetroPie-Setup version: 4.8.2 (b11c10a0)
This is the latest version, it's not the update that added the new RetroArch version, it's probably in a previous log file.
What do you think about when I changed the 'audio latency' in the in-game retroarch menu, the sound goes perfect. If I refresh my twitch stream it seems like it actually keeps working.
If it works fine, then keep the option. Out of curiosity, does the issue occur with the
mGBA
core, while playing a GBA game (without the change to audio latency) ? -
@mitu I'll look at the others.
The setting works when I change it. But then when I load the game again its broken until I change the latency setting to something else again. So odd! Maybe a janky fix could be to make the emulator run a script which changes the latency by +1 or -1 every time the game starts?
-
@mitu sorry just seen the GBA question. Ill have a go and see!
-
@mitu said in Audio issue when streaming to twitch:
Out of curiosity, does the issue occur with the mGBA core, while playing a GBA game (without the change to audio latency) ?
Just went through the motions and yep, same thing! Audio fine on the recording/stream but locally goes horrific
-
@mitu Sorry to keep replying, Im trying to drop information as I find it. A local copy of the Pi log shows:
RetroPie-Setup version: 4.4.1 (f671bb39)
System: Linux retropie 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/LinuxCould I possibly roll back to this?
-
@yooodt said in Audio issue when streaming to twitch:
@mitu Sorry to keep replying, Im trying to drop information as I find it. A local copy of the Pi log shows:
RetroPie-Setup version: 4.4.1 (f671bb39)
System: Linux retropie 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/LinuxHm, that's a little strange, since 4.4 was released 4 years ago, using Raspbian Stretch, which doesn't receive updates any longer. Also, your OS is based on buster, which suggests you've either copied the logs or upgraded the OS also. How did you do the upgrade ?
To the RetroArch version, 4.4 was using v1.7.1 - which is also quite old. Pinpointing a possible regression to a particular code change is going to be difficult, but if you upgraded in-situ your old 4.4 to buster, then I'd suggest you first try to reproduce the issue on a clean image.
-
@mitu ah I see. Perhaps this local copy isn't thr one I started with. Might be an old backup of an early experiment.
This said I did do a rollback and the problem still persisted. On yours, have you tried the latency change mid game to stop the glitching? Be interested to know if the fix is specific to me or if it works on all. This would help me work out if its something I need to fix locally or wait for a RP update.
If I went down the clean install route, is it as simple as deleting the pie directory? Or is there a command line to do this? Thank you so much for your help
-
@mitu ah I see. Perhaps this local copy isn't thr one I started with. Might be an old backup of an early experiment.
Not sure what you mean - is the log fragment (with version 4.4) from your current 4.8 system ? (where you have the problem)
This said I did do a rollback and the problem still persisted.
How exactly did you do the rollback ? Did you install an earlier backup - from before the update ?
On yours, have you tried the latency change mid game to stop the glitching? Be interested to know if the fix is specific to me or if it works on all. This would help me work out if its something I need to fix locally or wait for a RP update.
I haven't tried yet - is this in the Audio settings menu ? Note that I just tried the Record function, since I don't have any streaming account (Twitch or otherwise). What I've noticed is that the
lr-snes9x
core doesn't have the issue, though a slight audio cracking appears periodically.If I went down the clean install route, is it as simple as deleting the pie directory? Or is there a command line to do this? Thank you so much for your help
No, I was suggesting just to try with a clean image installation - from the latest RetroPie Pi3 image - without any updates. This eliminates any problems caused by an OS upgrade (held libraries, incompatible configs, etc.) If the issue doesn't occur on a clean image, then try a Retropie update, which should install the latest RetroArch and you can re-test to see if the issue occurs after this version upgrade.
-
@mitu said in Audio issue when streaming to twitch:
@mitu ah I see. Perhaps this local copy isn't thr one I started with. Might be an old backup of an early experiment.
Not sure what you mean - is the log fragment (with version 4.4) from your current 4.8 system ? (where you have the problem)
On a separate disk I have a backup of my emulators etc. All the log files on the actual pi seemed to say 4.8 from current system so I thought perhaps the one i located may have been where I started from.
This said I did do a rollback and the problem still persisted.
How exactly did you do the rollback ? Did you install an earlier backup - from before the update ?
I ran some code from an earlier forum post but changed the hex to the one I saw in the log file which I think made it install the older version. On my phone so can't quote the exact text.
On yours, have you tried the latency change mid game to stop the glitching? Be interested to know if the fix is specific to me or if it works on all. This would help me work out if its something I need to fix locally or wait for a RP update.
I haven't tried yet - is this in the Audio settings menu ? Note that I just tried the Record function, since I don't have any streaming account (Twitch or otherwise). What I've noticed is that the
lr-snes9x
core doesn't have the issue, though a slight audio cracking appears periodically.It's on the main menu under 'options' I think, it says latency as a menu header. I access it mid game by holding my menu (ps) button and pressing triangle although this won't mean much unless you're also using a ps3 controller!
If I went down the clean install route, is it as simple as deleting the pie directory? Or is there a command line to do this? Thank you so much for your help
No, I was suggesting just to try with a clean image installation - from the latest RetroPie Pi3 image - without any updates. This eliminates any problems caused by an OS upgrade (held libraries, incompatible configs, etc.) If the issue doesn't occur on a clean image, then try a Retropie update, which should install the latest RetroArch and you can re-test to see if the issue occurs after this version upgrade.
As in wipe the whole sd card and put a clean image of retropie on? I may try this even if this isn't what you mean as I have all my files backed up anyway!
Thanks
-
@mitu
update
I've completely re-imaged the SD card with the image from rasperry pi imager, I selected the option to install retropie as well from the menu.Dropped my Nes test roms on, added the twitch.cfg file (code below)
vcodec = libx264 acodec = libshine pix_fmt = yuv420p threads = 2 scale_factor = 1 format = flv video_preset = ultrafast video_profile = main video_tune = animation video_bufsize = 512k video_minrate = 512k video_maxrate = 512k video_r = 60 video_g = 120 video_keyint_min = 60 sample_rate = 44100 audio_preset = aac_he_v2 audio_global_quality = 1
and my emulators.cfg file is as follows:
lr-fbneo-nes = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fbneo/fbneo_libretro.so --subsystem nes --config /opt/retropie/configs/nes/retroarch.cfg %ROM%" lr-fceumm = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fceumm/fceumm_libretro.so --config /opt/retropie/configs/nes/retroarch.cfg %ROM%" default = "lr-fceumm" lr-nestopia = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-nestopia/nestopia_libretro.so --config /opt/retropie/configs/nes/retroarch.cfg %ROM%" lr-quicknes = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-quicknes/quicknes_libretro.so --config /opt/retropie/configs/nes/retroarch.cfg %ROM%" lr-fceumm-record-twitch = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fceumm/fceumm_libretro.so --config /opt/retropie/configs/nes/retroarch.cfg --recordconfig /home/pi/RetroPie/recording/twitch.cfg --record rtmp://live.
/live my key hidden --recordconfig /home/pi/RetroPie/recording/twitch.cfg %ROM%"The game audio is perfect but as soon as I use the twitch emulator version, it goes horrific locally. Same as before!
Does this code make my audio codec both locally AND on the stream 'libshine'? I wonder if its as simple as changing this.
-
@yooodt said in Audio issue when streaming to twitch:
Does this code make my audio codec both locally AND on the stream 'libshine'? I wonder if its as simple as changing this.
I don't think that matters, I've tested with another codec (
libmp3lame
instead oflibshine
) and it's the same behavior.
Changing the Audio Latency from the menu, does indeed fix the broken audio (after recording). My guess is that RetroArch simply re-initializes the audio because of that change and this fixes the local output, the value set through the options doesn't matter. It's not a matter of changing the default value - it's the process of changing the value mid-recording that's fixing it.I also tested using the latest RetroArch release and it seems the issue doesn't occur, I suppose it may have been fixed with some recent changes so that's a good thing.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.