RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Twitch Streaming Issues on Pi 4/RetroPie 4.6

    Scheduled Pinned Locked Moved Help and Support
    retropie 4.6twitchtwitch streamaudiostreaming
    16 Posts 3 Posters 1.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      BGallagherLA
      last edited by

      Hi all. So I had had previously gotten Twitch streaming working on my Pi 2, but as you can imagine, it was rather slow and choppy, at best, and unplayable at worst. When the new 4.6 version came out, I was happy to see that gameplay is drastically improved on the streams with my Pi 4... but there was no sound. Below is my twitch.cfg file which is based on an older forum post (https://retropie.org.uk/forum/topic/18303/livestreaming-to-twitch-on-retropie-4-4/6)

      vcodec = libx264
      acodec = aac
      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

      That earlier post was based on a 2016 article (http://selsine.com/2016/10/16/how-to-live-stream-to-twitch-from-a-retropie/) and when I noticed some of the different audio codex, I decided to give those a try. While libfdk_aac didn't work, the libmp3lame codex - which the author said gave him a "'bus error' at the following location: ‘/opt/retropie/supplementary/runcommand/runcommand.sh: line 855: 16499" - did actually work on NES, SMS and Genesis. Success! But... when I configured the mame-libretro and fba emulators for streaming, they wouldn't even start up after a long delay of just a black screen, and one time, EmulationStation even crashed. The games I tested played fine in the regular emulators when I wasn't trying to stream, and sure enough, when I turned the audio codex back to aac, it booted right up and streamed with no lag, though, sadly, with no sound either.

      I'm not well-versed at all in audio codex and whatnot, so can someone possibly point me in the right direction as far as what other audio codex to try to get everything working smoothly? Thanks, and sorry for the super long post haha.

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by

        In the newer version, there are a few streaming/recording profiles predefined - you should try one of them and stream, before using a custom file. You can access those settings from the RGUI, under the Settings -> Recording.

        1 Reply Last reply Reply Quote 0
        • B
          BGallagherLA
          last edited by

          I'm not seeing any of these profiles. This is all I see under Settings > Recording in RGUI - https://drive.google.com/file/d/1-5hq99qLSYWpyufNk7bCq4YrPWqagIU4/view?usp=sharing

          mituM 1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator @BGallagherLA
            last edited by

            @BGallagherLA I can't see the screenshot, it asks for a login.

            B 1 Reply Last reply Reply Quote 0
            • B
              BGallagherLA @mitu
              last edited by

              @mitu https://imgur.com/a/wfDbTDS

              mituM 1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @BGallagherLA
                last edited by

                @BGallagherLA This looks about right - the Stream Quality is where the presets can be set.

                B 1 Reply Last reply Reply Quote 0
                • B
                  BGallagherLA @mitu
                  last edited by

                  @mitu Still no audio on Mame. Even when I change one of the presets it goes right back to Low automatically. I have streaming working fine with all of the above settings with libmp3lame as the audio codex for NES, SMS and Megadrive/Genesis. When I try to load a game on Mame, it doesn't even open. The only way it will work on the streaming emulators I created (using those links in the original post as guides) for Mame or FBA is if aac is the audio codex... and then it streams with no audio. What are some of the other audio codex I can try to alleviate this?

                  1 Reply Last reply Reply Quote 0
                  • B
                    BGallagherLA
                    last edited by

                    Update: I was tinkering around with audio codecs and finally found one that works with everything - libshine. Enter that into the twitch.cfg file with all the above settings and everything works fantastic!

                    B 1 Reply Last reply Reply Quote 0
                    • B
                      BGallagherLA @BGallagherLA
                      last edited by

                      @BGallagherLA CC: @mitu Just FYI, I got it working properly with audio codec libshine.

                      mituM 1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator @BGallagherLA
                        last edited by

                        @BGallagherLA Thanks for the heads-up. Can you post your .cfg file, for reference ?

                        B 1 Reply Last reply Reply Quote 0
                        • B
                          BGallagherLA @mitu
                          last edited by

                          @mitu Sure thing!

                          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

                          With this twitch.cfg file, I've had successful stream tests on NES (Bionic Commando), Sega Master System (Astro Warrior), Genesis (NHL 94), MAME (NBA Jam) and FBA (Street Fighter III).

                          1 Reply Last reply Reply Quote 1
                          • nestalgicN
                            nestalgic
                            last edited by

                            Hey guys!
                            This is my first post here.
                            I've been trying to stream directly from RPi3 and I followed the famous Selsine and Retro Resolution guides (https://retroresolution.com/2016/07/06/recording-live-gameplay-in-retropies-retroarch-emulators-natively-on-the-raspberry-pi/ AND http://selsine.com/2016/10/). I got that, but it's too slow when I'm playing (almost impossible to play), although the output was ok (streaming and record).
                            Check my tests:

                            <iframe src="https://player.twitch.tv/?video=650382004&parent=www.example.com" frameborder="0" allowfullscreen="true" scrolling="no" height="378" width="620"></iframe>

                            <iframe src="https://player.twitch.tv/?video=645570961&parent=www.example.com" frameborder="0" allowfullscreen="true" scrolling="no" height="378" width="620"></iframe>

                            I didn't change anything on /opt/retropie/configs/EMULATOR/emulators.cfg
                            Instead, I use to press "Start Streaming" on RGUI during the play.

                            Any idea about why playing is slow?

                            I've tried two Twitch config options as follow and both worked:

                            #1
                            vcodec = libx264
                            acodec = libmp3lame
                            pix_fmt = yuv420p
                            scale_factor = 2
                            threads = 3
                            video_crf = 25
                            video_preset = superfast
                            video_tune = animation
                            audio_global_quality = 75
                            sample_rate = 44100
                            format = flv

                            #2
                            vcodec = libx264
                            acodec = aac
                            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

                            B 1 Reply Last reply Reply Quote 0
                            • B
                              BGallagherLA @nestalgic
                              last edited by

                              @nestalgic I have never tried on a Pi3 but I did try on a Pi 2 and it was unplayable. I'm not sure if anyone has had success on a Pi 3, but I can tell you that it streams great on my Pi 4. I'd consider an upgrade to a Pi 4 if you want to stream. I'm hopefully picking up a capture card next week so I can add a video feed to my stream.

                              nestalgicN 1 Reply Last reply Reply Quote 0
                              • nestalgicN
                                nestalgic @BGallagherLA
                                last edited by

                                @BGallagherLA Hey! I'm glad to hear you about Pi 4 and I'll consider an upgrade onto it. I've been trying a lot on Pi 3, but I'm exhausted. I believe its hardware isn't good enough for this job.
                                I'd really love if I could avoid another PC to streaming.
                                Thanks my friend!

                                B 1 Reply Last reply Reply Quote 0
                                • B
                                  BGallagherLA @nestalgic
                                  last edited by

                                  @nestalgic You're welcome! My Twitch is

                                  if you wanna see what I've done so far.

                                  nestalgicN 1 Reply Last reply Reply Quote 0
                                  • nestalgicN
                                    nestalgic @BGallagherLA
                                    last edited by

                                    @BGallagherLA I've just watched your videos . Those are really nice! The main point is you can play "nice and soft" on RBPi4.
                                    If you check my streamings out you'll see the results are the same as yours. But unfortunetely unplayable on RBPi3. See you on Twitch!

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post

                                    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.