Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Specify bitrate #25

Open
JasonLocklin opened this issue Jan 2, 2020 · 2 comments
Open

feature: Specify bitrate #25

JasonLocklin opened this issue Jan 2, 2020 · 2 comments

Comments

@JasonLocklin
Copy link

Specific use-case: When downloading voice audio (such as podcasts or lectures) from Youtube over limited data plans, it would be great to be able to specify a very low bitrate in combination with the opus codec.

Feature request: A bitrate option in the parameters that is passed ffmpeg.

Workaround: Would adding parameters to either OutputFlags or FormatFlags in ydls.json work? For a 25kbps example, Youtube-dl would be --audio-quality 25K and for ffmpeg, -b 25k --mode mono.

@wader
Copy link
Owner

wader commented Jan 2, 2020

Hey! yes good idea. I've thought about adding support for some kind of named presets which could be used for things like this. Otherwise i guess having a specific option for audio/video bitrate would work, e.g. something like a128kbps or 128kabr for 128kbps audio bitrate. But i wonder if ydls still should try to get the high quality source format?

Yes that workaround should work i think. For example you could add an additional format something like:

...
    "ogglow": {
      "Formats": [
        "ogg"
      ],
      "Streams": [
        {
          "Specifier": "a:0",
          "Codecs": [
            {
              "Name": "opus",
              "FormatFlags": [
                "-b:a",
                "25k"
              ]
            }
          ]
        }
      ],
      "Ext": "ogg",
      "MIMEType": "audio/ogg"
    },
...

But note that the bitrate flags will only be used if transcode is needed, you could combine with the "retranscode" option i guess. A bit messy so something better would be nice.

Let me know if it works. This would still download the "best" source format sorted by codec and bitrate but i guess in most cases it's the output from ydls that you want to limit.

@JasonLocklin
Copy link
Author

JasonLocklin commented Jan 2, 2020

Thanks! I will give it a shot later and update.

edit: yes, I think it should always start with the high-quality format. Transcoding from one lower bitrate codec to a second, different low-bitrate codec would be a recipe for artifacts and degraded audio quality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants