To disable Webm video download in yt-dlp via script

Forum Forums General Tips and Tricks To disable Webm video download in yt-dlp via script

  • This topic has 9 replies, 4 voices, and was last updated Mar 19-8:11 pm by blur13.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #102234
    Member
    RJP

      Of course this can be done by hand, but …

      A script fixs video´s name also.

      The script:

      #!/bin/bash
      yad --center --width=500 --height=50 --text-align=center --text="This script install config file for YouTube videos for avoinding webm videos"
      if [ $? = 0 ];
      then
      x-terminal-emulator -e mv $HOME/.config/yt-dlp/config $HOME/.config/yt-dlp/config.orig && \
      x-terminal-emulator -e mkdir -p $HOME/.config/yt-dlp && \
      x-terminal-emulator -e touch $HOME/.config/yt-dlp/config && 
      {                                   
      echo '--ignore-errors '
      echo '# --no-playlist '
      echo '# Save in $HOME '
      echo '-o ~/%(title)s.%(ext)s '
      echo '# Prefer 1080p or lower resolutions '
      echo '-f bestvideo[ext=mp4][width<1280][height<=720]+bestaudio[ext=m4a]/bestvideo[width<1280][height<=720]+bestaudio/best[width<1280][height<=720]/best '
      } > $HOME/.config/yt-dlp/config
      yad --center --width=900 --height=30 --text-align=center --text="This script installed config file to $HOME/.config/yt-dlp/config file. \
      Downloaded videos are coming into your home directory \
      You can find backup from $HOME/.config/yt-dlp/config.orig ... if there was file before"
      else exit 0
      fi

      PS. Display flickering when running this script.

      Attachments:
      #102322
      Member
      stevesr0

        Hi RJP,

        This script just insures that only mp4 video format videos will download, correct?

        It doesn’t force transcoding for other formats (say webm) to mp4 automagically, does it?

        stevesr0

        #102324
        Member
        RJP

          This script just insures that only mp4 video format videos will download, correct?

          It doesn’t force transcoding for other formats (say webm) to mp4 automagically, does it?

          stevesr0

          Yes, it downloads videos as mp4.

          #102511
          Member
          stevesr0

            Hi RJP,

            My goal was to download a YouTube video as an .mp4 format that would embed and run directly and nicely in an Impress presentation.

            When I ran your script, I got an error about the center option.

            Then I saw a post in an Unix and Linux Stack Exchange on downloading a specific format and it said to use
            youtube-dl -f mp4 <url>

            I ran yt-dlp -f mp4 <URL> and the resulting download was an mp4 file.

            The only problem is that I still get flickering when it runs directly from the slide show. I am guessing that this is due to a framerate shift that I need to address – perhaps with ffmpeg. But that might be incorrect, because there is no flicker when it runs from mpv.

            stevesr0

            • This reply was modified 1 year, 1 month ago by stevesr0.
            #102536
            Member
            RJP

              The script only tells where download comes and which form (mp4). It works ok for me.

              #102538
              Member
              RJP

                If you use youtube-dl, you need to copy $HOME/.config/yt-dlp to $HOME/.config/youtube-dl

                cp -ax $HOME/.config/yt-dlp $HOME/.config/youtube-dl

                #102542
                Member
                blur13

                  usually with youtube,

                  yt-dlp -f 22 <URL>

                  will download a complete mp4 file with audio and video already combined (usually in 720p).

                  #102544
                  Member
                  RJP

                    usually with youtube,

                    yt-dlp -f 22 <URL>

                    will download a complete mp4 file with audio and video already combined (usually in 720p).

                    You can use that way too. Graphical way is available also.

                    https://www.antixforum.com/forums/topic/simple-youtube-download-script/

                    #102561
                    Member
                    Robin

                      yt-dlp -f 22 <URL>

                      You should check which formats actually exist for a specific video. The format 22 might fail in many cases. Moreover 22 provides poor audio. So try first:
                      yt-dlp -F <URL>

                      And from the listing returned by the command select the appropriate format code (or combination of audio and video format codes), e.g one of the following:

                      yt-dlp -f '137+140' <URL>
                      yt-dlp -f '136+140' <URL>
                      yt-dlp -f '135+140' <URL>
                      yt-dlp -f '134+140' <URL>
                      

                      Avoid any formats marked as VP9 unless your hardware doesn’t support this codec already, otherwise it will easily outpower your CPU, since then the video must be completely get rendered in software on your device. Most hardware around still doesn’t natively support VP9, so it’s a good idea to avoid it generally. (For learning how your hardware deals with VP9 just observe your CPU load while playing, e.g. -f ‘247+251’, compare it to -f ‘136+140’ or try -f ‘303+251’ and compare it to -f ‘299+140’ and then decide.)

                      Windows is like a submarine. Open a window and serious problems will start.

                      #102604
                      Member
                      blur13

                        Robin,

                        All this is correct and I agree with you. However, with youtube specifically -f 22 is almost always a complete mp4 file. On old hardware this saves you the process of merging audio+video stream, and on old hardware the semi-hd 720p with mediocre audio might even play more fluidly than 1080p with best audio.

                      Viewing 10 posts - 1 through 10 (of 10 total)
                      • You must be logged in to reply to this topic.