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

HEVC recode. Is that possible? #17134

Closed
5 of 9 tasks
gabriellluz opened this issue Aug 2, 2018 · 13 comments
Closed
5 of 9 tasks

HEVC recode. Is that possible? #17134

gabriellluz opened this issue Aug 2, 2018 · 13 comments

Comments

@gabriellluz
Copy link

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.07.29. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.07.29

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
[debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
[debug] youtube-dl version 2018.07.29
[debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2
[debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
[debug] Proxy map: {}
...
<end of log>

If the purpose of this issue is a site support request please provide all kinds of example URLs support for which should be included (replace following example URLs by yours):

Note that youtube-dl does not support sites dedicated to copyright infringement. In order for site support request to be accepted all provided example URLs should not violate any copyrights.


Description of your issue, suggested solution and other information

Explanation of your issue in arbitrary form goes here. Please make sure the description is worded well enough to be understood. Provide as much context and examples as possible.
If work on your issue requires account credentials please provide them or explain how one can obtain them.

Hi there.
I'm currently using Youtube-DL as an archiving tool and it works great. The problem is I always have to use Handbrake after downloading new videos in order to encode them to hevc.
I see Youtube-DL has a recode option but that option doesn't seem to use HEVC as a codec. Is there a way I can use directly HEVC video and OPUS audio with youtube-dl? It'd be so much easier to me since HEVC and OPUS are great standards in the YouTube archiving community. Yes, we do have a community against censorship and we provide archiving of some very important YouTube channels in case they get removed or banned.

@bato3
Copy link
Contributor

bato3 commented Aug 2, 2018

If I know Youtube-dl don't change encoding. This can be do in post-process

https://trac.ffmpeg.org/wiki/Encode/H.265
https://wiki.libav.org/Encoding/hevc

eg youtube-dl https://www.youtube.com/watch?v=BaW_jenozKc --postprocessor-args "-c:v libx265"

@WolfganP
Copy link

WolfganP commented Aug 2, 2018

I see Youtube-DL has a recode option but that option doesn't seem to use HEVC as a codec. Is there a way I can use directly HEVC video and OPUS audio with youtube-dl? It'd be so much easier to me since HEVC and OPUS are great standards in the YouTube archiving community. Yes, we do have a community against censorship and we provide archiving of some very important YouTube channels in case they get removed or banned.

Try youtube-dl -v yourvideoURL -F and see if any of the offered resolutions is hvec encoded already and audio is offered in opus format.
Then you can choose your video+audio specific streams and download them selectively as in youtube-dl -v yourvideoURL -f 135+140

@Hrxn
Copy link

Hrxn commented Aug 2, 2018

Try youtube-dl -v yourvideoURL -F and see if any of the offered resolutions is hvec encoded already and audio is offered in opus format.

YouTube already offers HEVC encoded streams? This is new to me.. since when?

@WolfganP
Copy link

WolfganP commented Aug 2, 2018

YouTube already offers HEVC encoded streams? This is new to me.. since when?

IIRC, some 4K videos may be offered both in HEVC and VP9. I don't remember if that also extended to lower resolutions' encoding, or if that was simple testing/experiments on YT side

@gabriellluz
Copy link
Author

Hi guys.
I've tried youtube-dl https://www.youtube.com/watch?v=BaW_jenozKc --postprocessor-args "-c:v libx265 -b:v 800k -c:a opus -b:a 128k" It works with HEVC (thanks :)), but I can't convert audio to OPUS. I want the output as an MKV file. Also, adding -x --audio-format opus --audio-quality 128k doesn't work because it renders an OPUS file. I want a MKV file but I don't want separate files (MP4 + OPUS).

@bato3
Copy link
Contributor

bato3 commented Aug 3, 2018

youtube-dl https://www.youtube.com/watch?v=BaW_jenozKc --postprocessor-args "-c:v libx265 -b:v 800k -c:a opus -strict experimental -b:a 128k"
but it still mp4

@WolfganP
Copy link

WolfganP commented Aug 3, 2018

Did you try --merge-output-format mkv ?

@gabriellluz
Copy link
Author

gabriellluz commented Aug 4, 2018

Yes, I've tried. Now it works! Can we also use CRF instead of bitrate? YES, WE CAN:

youtube-dl https://www.youtube.com/watch?v=BaW_jenozKc --postprocessor-args "-c:v libx265 -preset slow -crf 15 -c:a opus -strict experimental -b:a 128k" --merge-output-format mkv

Please, put that in the Wiki because many people need that info. Thank you guys so much!

@williamjmorenor
Copy link

Also works for mp4:

youtube-dl https://www.youtube.com/watch?v=BaW_jenozKc --postprocessor-args "-c:v libx265 -preset slow -crf 15 -c:a opus -strict experimental -b:a 128k" --merge-output-format mp4

I preffer a higher -crf, 28 is the default.

@AravindhStanley
Copy link

@williamjmorenor This works amazing. Any way to show progress for the post processing?

@Littlesloths
Copy link

It looks like all the postprocessing is done after the file is fully downloaded?
I tried this on a continuous stream and it does not work.
Any idea how to recode a stream on the fly?

@rautamiekka
Copy link
Contributor

Quality loss is a problem only if you use the wrong settings, but re-encoding for smaller size is pretty hard due to the amount of trial-and-error required, I know from trying it so many times.

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

9 participants