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

how to have best quality, but mp4, not mkv? #12299

Closed
rediscu opened this issue Feb 28, 2017 · 14 comments
Closed

how to have best quality, but mp4, not mkv? #12299

rediscu opened this issue Feb 28, 2017 · 14 comments

Comments

@rediscu
Copy link

@rediscu rediscu commented Feb 28, 2017

Hello! Please help me with this:
I want to download YT playlist with best quality video and audio (OPUS should be better than default 128k m4a commonly used with 1080p video),
and merge it to mp4 container instead of mkv. What command should I use
to dl both streams, convert audio and merge?

@yan12125 yan12125 closed this Feb 28, 2017
@rediscu
Copy link
Author

@rediscu rediscu commented Feb 28, 2017

@yan12125 : In this example I'll have best m4a audio (usually 128k), but i want to dl OPUS (which, I believe is better), convert it to m4a using ffmpeg and merge with mp4 video

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 28, 2017

Sorry I misread your question. Currently it's impossible with command line only because merge (FFmpegMergerPP) always occurs before format conversion. (FFmpegVideoConvertorPP)

@yan12125 yan12125 reopened this Feb 28, 2017
@rediscu
Copy link
Author

@rediscu rediscu commented Feb 28, 2017

@yan12125 may be it's possible in two or more batch passes?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 28, 2017

I don't think there's a simple way because FFmpegMergerPP relies on the relationship between format_id (itag) and file extensions for correct merging, yet FFmpegVideoConvertorPP changes this relationship.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 28, 2017

Here's a workaround: merge it into mkv and convert to mp4. -vcodec copy guarantees that re-encoding occurs in audio tracks only.

youtube-dl -v 9SF5NcELH9E -f 'bestvideo[ext=mp4]+bestaudio[acodec=opus]' --recode-video mp4 --postprocessor-args '-vcodec copy'
@rediscu
Copy link
Author

@rediscu rediscu commented Feb 28, 2017

@yan12125 having this:
q

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 28, 2017

Ah, on Windows you need double quotes instead of single quotes.

@rediscu
Copy link
Author

@rediscu rediscu commented Feb 28, 2017

@yan12125 ok, that worked, but I'm having the same audio bitrate that I tried to avoid ~128k

used this command: youtube-dl -v lL7vgDRZxfo -f "bestvideo[ext=mp4]+bestaudio[acodec=opus]" --recode-video mp4 --audio-quality 256k --postprocessor-args "-vcodec copy"

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 28, 2017

For lL7vgDRZxfo, Youtube does not provide a format higher than ~130k.

FYI: --audio-quality is an option for --extract-audio. It does not make sense to specify higher bitrates than the original.

@rediscu
Copy link
Author

@rediscu rediscu commented Feb 28, 2017

@yan12125 it has 251 webm 153k opus@160k
afaik opus compression is more effective than m4a, so transcoding opus to m4a with higher bitrate than original opus makes sence

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 28, 2017

251 webm 153k opus@160k

YouTube seldom gives correct numbers in those fields.

opus compression is more effective than m4a, so transcoding opus to m4a with higher bitrate than original opus makes sence

Got it. This should work:

youtube-dl -v lL7vgDRZxfo -f "bestvideo[ext=mp4]+bestaudio[acodec=opus]" --recode-video mp4 --keep-video --postprocessor-args "-vcodec copy -b:a 256k"
@rediscu
Copy link
Author

@rediscu rediscu commented Feb 28, 2017

Looks like I have better audio spectrum now (16-20 khz is not killed anymore). Thank you very much, @yan12125 !

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 28, 2017

Glad that works. As existing options suffice and they're not super complicated, I'll close this.

@yan12125 yan12125 closed this Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.