RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Take and Scrape Your Own Videos

    Scheduled Pinned Locked Moved Ideas and Development
    videosscraperruncommandemulationstatio
    29 Posts 8 Posters 7.6k 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.
    • meleuM
      meleu @herb_fargus
      last edited by

      @herb_fargus said in Take and Scrape Your Own Videos:

      onmenu is a good solution (which I was unaware of)

      runcommand-onmenu.sh feature doesn't exist yet. I'll try to submit a PR for runcommand.sh implementing this later today.

      • Useful topics
      • joystick-selection tool
      • rpie-art tool
      • achievements I made
      herb_fargusH 1 Reply Last reply Reply Quote 0
      • herb_fargusH
        herb_fargus administrators @meleu
        last edited by herb_fargus

        @meleu how would the on menu be any different than onstart unless there is some mechanism for modifying the dialog menu for runcommand?

        Or are you saying it's an option in the runcommand menu to run a script?

        If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

        Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

        meleuM 1 Reply Last reply Reply Quote 0
        • meleuM
          meleu @herb_fargus
          last edited by meleu

          @herb_fargus runcommand-onmenu.sh would be a script to be launched only if user invoke runcommand menu and choose the option to launch it. runcommand-onstart.sh is always executed before the game is launched.

          edit
          by the way, I've submitted the PR and tagged you there: https://github.com/RetroPie/RetroPie-Setup/pull/2009

          • Useful topics
          • joystick-selection tool
          • rpie-art tool
          • achievements I made
          herb_fargusH 1 Reply Last reply Reply Quote 1
          • herb_fargusH
            herb_fargus administrators @meleu
            last edited by herb_fargus

            @meleu Necropost AHOY!

            • With the advent of raspbian stretch and subsequently ffmpeg integrated in the repos

            • the runcommand onmenu functions integrated

            • and Retroarch compiled with ffmpeg support:

            I think I'm ready to give this another go. The integration is all pretty much handled as far as no more need for source compilations, now the trick is just configuring the onstart/onmenu scripts and optimal settings for ffmpeg to capture native res gameplay without degrading performance.

            Runcommand OnMenu Options

            As far as onstart/omenu scripts go, a few options:

            • OnMenu that just launches the default config to the default video path with the saved video file being named after the rom.
            • OnMenu that creates a videos folder for the system being launched, uses the default config, and saves the video in the created videos folder named after the rom.
            • OnMenu with dialog options to select the saved video path and video config/container (mkv, mp4 etc), and maybe options to name based on rom, date, rom+date, etc.

            Runcommand OnMenu

            Per the docs, create a script called recordvideo.sh in `

            opt/retropie/configs/all/runcommand-menu/`
            

            With the contents todo incomplete!

            recordvideos.sh

            #!/usr/bin/env bash
            
            system="$1"
            emulator="$2"
            rompath="$3"
            launch="$4"
            rom_file="${rompath##*/}"
            rom="${rom_file%.*}"
            mediadir="$HOME/RetroPie/roms/$system/images"
            videofile="$mediadir/$rom-video.mkv"
            
            
            # Create videos folder in system's rom folder
            if [[ ! -d "$mediadir" ]]; then
                mkdir -p "$mediadir"
                dialog --msgbox "$mediadir created!" 20 60 >/dev/tty
            fi
            
            # Launch to record gameplay on RetroArch Systems.
            if [[ "$launch" =~ retroarch ]]; then
            eval "$launch" "--record '$videofile'" 
            exit 1
                else
                dialog --msgbox "Video recording is not supported for this system" 20 60 >/dev/tty
            fi
            

            if you want to force ~30 second limits for your videos you can substitute the following code:

            eval "$launch" "--record '$videofile'" & sleep 33
            killall retroarch
            exit 1
            

            Configs

            The default path for recorded videos is:

            /opt/retropie/configs/all/retroarch/records/
            

            If you add a custom config for ffmpeg the default path is:

            /opt/retropie/configs/all/retroarch/records_config/
            

            Examples:

            default.cfg:

            vcodec = libx264rgb
            pix_fmt = bgr24
            acodec = flac
            format = matroska
            video_qp = 0
            

            optimised.cfg:

            format = matroska
            threads = 3
            vcodec = libx264rgb
            video_preset = ultrafast
            video_tune = animation
            pix_fmt = bgr24
            video_qp = 0
            acodec = flac
            

            mp4.cfg:

            vcodec = libx264rgb
            pix_fmt = bgr24
            acodec = aac
            format = mp4
            video_qp = 0
            

            twitch.cfg:

            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
            

            If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

            Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

            ClydeC V 2 Replies Last reply Reply Quote 6
            • ClydeC
              Clyde @herb_fargus
              last edited by

              Hello @herb_fargus, I'm thinking about streaming my Retropie's screen to my Kubuntu desktop PC that's connected to my video projector, so that an audience of guests could watch the games. Can you kindly give me some hints how to set that up?

              herb_fargusH 1 Reply Last reply Reply Quote 0
              • herb_fargusH
                herb_fargus administrators @Clyde
                last edited by

                @clyde haven't the foggiest. Could try the twitch thing, or there is some experimental streaming thing that doesn't use a vnc server. Can't remember what it is, never tried it myself though I imagine there would be some latency

                If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                ClydeC 1 Reply Last reply Reply Quote 0
                • ClydeC
                  Clyde @herb_fargus
                  last edited by Clyde

                  @herb_fargus Well, thanks anyway. I may look further into it when I have the time and leisure, since it isn't urgent at the moment. Latency wouldn't be a big issue as long as it's not more than a few seconds, since the audience wouldn't play but just watch. edit: On the players' side, there should be as little lag as possible, of course.

                  herb_fargusH 1 Reply Last reply Reply Quote 0
                  • herb_fargusH
                    herb_fargus administrators @Clyde
                    last edited by

                    @clyde I started a post specific to the whole streaming thing and I think I came up\with a viable software solution, the uv4l raspidisp driver / webrtc server enables you to stream video with not a terrible latency that can be accessed from any web browser on the same network. Audio may be a bit of a trick to sort but I've tested it and it functions.

                    Further discussion on this thread if interested.

                    If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                    Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                    ClydeC 1 Reply Last reply Reply Quote 1
                    • ClydeC
                      Clyde @herb_fargus
                      last edited by

                      @herb_fargus Wow, that's great. I'll check it out.

                      1 Reply Last reply Reply Quote 0
                      • V
                        Valente @herb_fargus
                        last edited by

                        Great post. Unfortunately, I'm having an issue with the recording function on the RetroPie while recording gameplay. When launching an NES game, the emulator is really slow.

                        Has anyone encountered this problem?

                        Thanks,

                        Valente

                        V 1 Reply Last reply Reply Quote 0
                        • V
                          Valente @Valente
                          last edited by Valente

                          Just to follow up, I noticed a YouTube video of a user also complaining about lag when using ffmpeg. Even with my Raspberry Pi 3B+, the lag makes NES games unplayable.

                          I've tried using other core emulators and recording settings to no avail. Let me know if anyone has any positive experiences with RetroPie and recording.

                          Thanks,

                          @Valente

                          1 Reply Last reply Reply Quote 0
                          • herb_fargusH
                            herb_fargus administrators
                            last edited by herb_fargus

                            More necroposting,

                            There have been some changes with RetroArch with the video recording where in theory we should be able to use a hotkey to start/stop recordings. The latest Raspbian also has ffmpeg with hardware decoding so I wonder if that could help with some of the performance issues people have been having. though video recording is encoding a video so that may not help if it only has hardware acceleration for decoding.

                            If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                            Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                            1 Reply Last reply Reply Quote 0
                            • C
                              corezon
                              last edited by corezon

                              @herb_fargus I found that relying on sleep to properly time a 30 second video was getting mixed results so I modified your script a little to crop the video afterward for a more uniform recording length.

                              It requires that you install ffmpeg beforehand though.

                              #!/usr/bin/env bash
                              
                              system="$1"
                              emulator="$2"
                              rompath="$3"
                              launch="$4"
                              rom_file="${rompath##*/}"
                              rom="${rom_file%.*}"
                              mediadir="$HOME/RetroPie/roms/$system/images"
                              tmpfile="/tmp/$rom-video.mkv"
                              videofile="$mediadir/$rom-video.mkv"
                              
                              
                              # Create videos folder in system's rom folder
                              if [[ ! -d "$mediadir" ]]; then
                                  mkdir -p "$mediadir"
                                  dialog --msgbox "$mediadir created!" 20 60 >/dev/tty
                              fi
                              
                              # Launch to record gameplay on RetroArch Systems.
                              if [[ "$launch" =~ retroarch ]]; then
                              eval "$launch" "--record \"$tmpfile\"" & sleep 120
                              
                              killall retroarch 
                              
                              # Crop video to 30 seconds
                              eval "ffmpeg -y -t 30" "-i \"$tmpfile\"" "-acodec copy \"$videofile\"" &
                              
                              exit 1
                                  else
                                  dialog --msgbox "Video recording is not supported for this system" 20 60 >/dev/tty
                              fi
                              
                              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.