Jump to d.1 to see the work-around command I am using.
Why am I doing this?
It is SOMETIMES best to just do -f ba[ext=m4a] then change the extension to .mp4, my concern being that it will sometimes fail (or that it can be done more concisely)!
OTHER TIMES: I need the lowest quality file, must be video, that can still give a general idea of what's visually occurring (usually 144p or 360p). I don't want to sacrifice audio quality if at all possible. I always have to compress and re-format things: sometimes it takes an hour--I really want to cut steps down.
My goal is:
- Understand how yt-dlp and ffmpeg work better.
- Download the highest audio quality and a specific video quality.
- Use the fewest commands possible to handle all potential inputs.
- Get an mp4 output (not webm, not raw audio), consistently; ideally, without use of ffmpeg, if possible; alternatively, to use a single command that includes the yt-dlp string and the ffmpeg string on one line (such as
yt-dlp -flags && ffmpeg -flags).
Known problems:
Best guesses did not work:
a.
yt-dlp https://url.com/uri -f wv+ba* -o "./my/location/filename.mp4"where wv means worst-audio and ba means best-audio and the the*should mean "somehow make best-audio the priority!" Sadly, I get mixed results: usually a worst-video file with no audio.yt-dlp https://url.com/uri -f wv+ba -o "./my/location/filename.mp4". Give the wrong extension.
b.
yt-dlp https://url.com/uri -f ba[ext=m4a] -o "./my/location/filename.m4a"This gives me an m4a file and then I need to do a rename command[ext=mp4]is not an option. This also does not give video, which is NOT IDEAL.
c.
yt-dlp https://url.com/uri -f 134+ba -o "./my/location/filename.mp4" --merge-output-format mp4, whereid 134is 360p video. This givesERROR: Postprocessing: Stream #1:0 -> #0:1 (copy), and there is no merged output file (only two tmp files with audio-only and video-only).yt-dlp https://url.com/uri -f 134+ba -o "./my/location/filename.mp4" --merge-output-format mkv && rename filename.mkv filename mp4, whereid 134is 360p video. This gives a file that is an mp4 file, but it is seen by the system as an mkv file (and cannot be used for the desired purpose).
d.
yt-dlp https://url.com/uri -f 134 -o "./my/location/filename.webm && yt-dlp https://url.com/uri -f ba -o "./my/location/filename.m4a" && ffmpeg -i .\relativePath\inputFilename.f251.webm -i .\relativePath\inputFilename.f248.webm -c:v mpeg4 -q:v 0 -q:a 0 -c:v copy .\relativePath\outputFilename.mp4". Note: the audio/video can be input in any order, but the -i flag should come first.
About workaround d.1:
If I use -q:a 100, the output file will be 10 times larger than the input files; so, I think I am not getting lossless audio....
Note: the audio/video can be input in any order, but the -i flag should come first.
Also, it is important to not use asterisks bv*+ba because that will prioritize the best video quality with combined audio, and you need separate files: you can guarantee separate files by excluding the asterisk.