Mass convert media to x265

extide

2[H]4U
Joined
Dec 19, 2008
Messages
3,494
I have several thousand TV shows, a bunch of movies, etc. Most of them are in x264 or xvid or something like that. I would like to, over time, convert everything to x265 to save on some space. It has been a LONG time since I have done anything with video like this so I have no idea what apps are good these days.

What is the best program to do this? Ideally I could run this program by command line, that way I could automate this to a degree. I want to set up a couple standard profiles (like ones for SD, 720p, 1080p, etc) so basically if my source file is 1080p it will use the 1080p profile I set, all the 720p videos will all use the 720p profile, etc.

Basically I will write up some scripts or something that would use something to profile the video, see what res it is, and then it would generate the right command lines to pass to the compression program.

Questions:
  • What is a good app to do the compression itself, and preferably I can operate it entirely by command line
  • Is there an app that I can use to profile videos, like see what res they are / etc, that can run on a command line?
 
I am not sure you will see many gains from transcoding a x264 to a x265 file. From what I understand if you already have the x264 all the source goodies have already been stripped down and optimized, so taking that and transcoding it to 265, I would think would get you worse to marginally worse IQ. Granted I have never tried, but I would think that you would really need the source material to get any kind of tangible results.

You could always try with Handbrake with a couple of you movies to see for sure.
 
Yeah, I had thought about that, but wanted to try it out and see what it looked like. I know that when I download something, if an x265 version is available, I will get it and they are wayy smaller. Like 200MB for a full 1hr 1080p tv show, friggin amazing!
 
H.265 is a great codec and unquestionably superior to H.264. The main issue is the lack of a good x265 encoder accessible to the general public. The x265 encoders that are accessible to most people produce video that looks like shit IMO. You can't compare the two codecs based on the quality of professional content because those tools aren't available to most people, and Hollywood, etc is going to try to make sure it stays that way.
 
I'm very interested in this as well. I would be willing to take a slight reduction in quality.
 
Throw me into the same boat for being interested in recoding my library over to x265.
It looks like using FFmpeg plus a few bash scripts would be the easiest approach to go ahead and do this on a large scale. The thought of manually queuing everything up via Handbrake seems..... painful.

Looks like version 3.0 of FFmpeg just came out, so.... woohoo!
 
I've been using ffmpeg for my encoding needs, here's what i've been using for h.265 encodes of dvd rips:

ffmpeg -i %1 -map 0 -c:a copy -c:s copy -c:v libx265 -x265-params crf=24 -vf yadif %2

where %1 is the input filename, and %2 is the output filename. remove "-vf yadif" if you don't need deinterlacing. (you won't given they're already h.264)
Note that the "-map 0" should copy any subtitle tracks if they're there in the source file.
You can tune the cf to your tastes. Lower numbers result in larger files.
 
Unless you are converting from source like the BluRay or DVD or a HDTV recording I don't see the point in converting the already highly compressed videos into H.265. You are going to lose a good deal of quality over a pretty insignificant amount of space savings.

And then your library will be a lot harder to play back in terms of decoding power and device support
 
The main reason that I want to convert everything over is because I've been meaning to standardize everything to the same format. I have the processing power, might as well do the latest and greatest. Plus, my naming schemes have differed drastically
over the years. It's more of an excuse to put everything in order than anything else xD
 
Unless you are converting from source like the BluRay or DVD or a HDTV recording I don't see the point in converting the already highly compressed videos into H.265. You are going to lose a good deal of quality over a pretty insignificant amount of space savings.

And then your library will be a lot harder to play back in terms of decoding power and device support
Pretty much this. If you compress already compressed video it is going to degrade the quality and might even increase the file size instead of reduce it.
There are a lot of settings and tweaking you can do when you compress something. it isn't simply x265. You can have the same video encoded x265 be 2GB with bad quality or 1GB with great quality using different settings.

But if you still want to do it I think you can use https://handbrake.fr
 
I'll believe it when I see it.

I didn't know that this was even controversial. There has been source content distributed in H.265 for a while now, with the same quality (or better) compared to H.264, but at half the file size. If you really want to see it, it's not difficult to find... Perhaps you are confusing the issues at play here. Again, there is no commonly available x265 encoder that doesn't suck. Professional content is typically created using an encoder that is simply not available to the general public (which is why it looks just as good if not better than H.264 content). If you're using something like Handbrake to create your H.265 content, you are not even coming close to utilizing it's full potential.
 
I didn't know that this was even controversial. There has been source content distributed in H.265 for a while now, with the same quality (or better) compared to H.264, but at half the file size. If you really want to see it, it's not difficult to find... Perhaps you are confusing the issues at play here. Again, there is no commonly available x265 encoder that doesn't suck. Professional content is typically created using an encoder that is simply not available to the general public (which is why it looks just as good if not better than H.264 content). If you're using something like Handbrake to create your H.265 content, you are not even coming close to utilizing it's full potential.
Of course it's controversial because it's a blanket statement that can only really be applied to narrow use cases. HEVC is "better" than H.264 for UHD content. It delivers reasonable results at about half the bitrate of H.264 for UHD content, or at least that is the design target for the codec. Note, reasonable doesn't necessarily mean more accurate to the source. It means visually pleasing with no objectionable visual artifacts. You can't assume that because the codec is "better" at UHD that it's a linear scale and for DVD res, 720p, or FHD it will do the same thing of delivering reasonable results at half the bitrate of H.264 at much lower resolutions.

To the OP, taking already transcoded content that went from DVD (MPEG-2) or Blu-ray (MPEG-2, VC1, H.264) to lower bitrate H.264 and compressing it again to HEVC with x265 is not a good idea. This is like recompressing all your MP3 to AAC. You should rerip the CDs to AAC, not add a generational loss to the files.

I'm not sure it's a good idea even if he went back to the original source DVD and Blu-ray discs. He'd need to compare the visual results against the size of the file and see if he thinks it's worth it.
 
You can't assume that because the codec is "better" at UHD that it's a linear scale and for DVD res, 720p, or FHD it will do the same thing of delivering reasonable results at half the bitrate of H.264 at much lower resolutions.
In my experience, it works great at lower res as well. I have some 100MB 720p tv shows and 200MB 1080p shows (1 hr shows) that look just as good as a ~700mb 720p on H.264, and ~1.2GB 1080p H.264 rip of the same thing.

To the OP, taking already transcoded content that went from DVD (MPEG-2) or Blu-ray (MPEG-2, VC1, H.264) to lower bitrate H.264 and compressing it again to HEVC with x265 is not a good idea. This is like recompressing all your MP3 to AAC. You should rerip the CDs to AAC, not add a generational loss to the files.

I'm not sure it's a good idea even if he went back to the original source DVD and Blu-ray discs. He'd need to compare the visual results against the size of the file and see if he thinks it's worth it.
I do understand this, but I don't think the hit will be THAT bad. For stuff my kids watch, especially, I don't care if it's a bit worse quality. Even the stuff I watch, I want to at least test it and see.
 
Mediacoder supports x265 and H265 if you are looking for something with a GUI. It also can use NVENC for h265 which is blisteringly fast if you have a gtx9x0 card
 
NVENC and Quicksync are quite inefficient with quality and bitrate though. If you want quality encodes, it is definitely not the way to go...
 
NVENC and Quicksync are quite inefficient with quality and bitrate though. If you want quality encodes, it is definitely not the way to go...

I have not found this to be the case with NVENC - but, as always YMMV
 
As other people have said; use Handbrake.
for cmdline usage see here. You can also export a queue and manually edit it (though I think the cmdline'd be easier)

and yes as people have mentioned you should compare quality/size afterwards, but that's no reason not to try

edit: nightly builds are available here
 
I have not found this to be the case with NVENC - but, as always YMMV

I've only used quicksync, and it was like this. When setting CRF, it would be 10-30% larger than a software encode and have worse IQ. From what I read on other forums, NVENC is even worse than quicksync. I'd like that to not be true because I have a GTX 980Ti and a 960 that I would love to use if/when I move stuff to HEVC. I'm a heavy user of Plex, so we're going to need much more efficient real-time H265 encoding before it's viable in that scenario (NVENC or QuickSnyc may just fit into that nicely if they become more reliable and Plex supports it).
 
I didn't know that this was even controversial. There has been source content distributed in H.265 for a while now, with the same quality (or better) compared to H.264, but at half the file size. If you really want to see it, it's not difficult to find... Perhaps you are confusing the issues at play here. Again, there is no commonly available x265 encoder that doesn't suck. Professional content is typically created using an encoder that is simply not available to the general public (which is why it looks just as good if not better than H.264 content). If you're using something like Handbrake to create your H.265 content, you are not even coming close to utilizing it's full potential.

I have seen comparisons and h264 still is better for quality at the same size. h265 needs time to mature. It will be better eventually. But new codecs are never better at the start. We saw the same with XviD to x264.
 
Comparisons of what exactly? What encoder was used?
I'll echo this.. i've done my own conversions and comparisons. There's very little difference between x264 and x265, as used with ffmpeg. Did some conversions from a MPEG-2 source (standard def dvd) w/ deinterlacing. Used CRF 20 for the h.264 files and CRF24 for the x265/HEVC stuff, medium preset on both. The only difference I saw was that it looked like x265 is rather more aggressive at removing film grain. Everything was a bit more flat than with h.264.

That was also looking at sill images, aka: not noticeable during playback.
 
I didn't know that this was even controversial. There has been source content distributed in H.265 for a while now, with the same quality (or better) compared to H.264, but at half the file size. If you really want to see it, it's not difficult to find... Perhaps you are confusing the issues at play here. Again, there is no commonly available x265 encoder that doesn't suck. Professional content is typically created using an encoder that is simply not available to the general public (which is why it looks just as good if not better than H.264 content). If you're using something like Handbrake to create your H.265 content, you are not even coming close to utilizing it's full potential.

Well then you have solved this thread.

OP is asking to encode his own content to H265 and you yourself admit that the good encoders are not available to him. So the conclusion is that he shouldn't use H265 because the x264 that is available to him is better.
 
Well then you have solved this thread.

OP is asking to encode his own content to H265 and you yourself admit that the good encoders are not available to him. So the conclusion is that he shouldn't use H265 because the x264 that is available to him is better.

I'm glad that you agree. There is nothing wrong with elaborating about why we are in our current situation. There is a lot of confusion between H.265 and x265. Many don't understand that H.265 is a specification and x265 is merely an open-source best-attempt at making a H.265 encoder.
 
Last edited:
Maybe I will have to wait for Polaris, as it supposedly does H265 in hardware (encode & decode), even 10-bit, up to 4k.
 
I'll believe it when I see it.

The technical aspects of H.265 (the new codec on the block) are superior to what H.264 offers (the old standard) but the current H.265 encoders, including but not limited to ffmpeg's routines and x265, are just not up to the task yet but they're improving constantly just as x264 constantly improved in overall quality and efficiency over the past decade or so. Now H.265 is moving in and with it the promise of files that are roughly half the actual byte-size while retaining the same or slightly better levels of visual quality. I think people get confused too quickly even nowadays so:

H.264 = old school standard format (ok, specification if you want it totally technically accurate) for video encoding, very well established, tons of research behind it and development for a decade
H.265 = the new kid on the block format (again, specification to be precise), technically offering files half the size with same or better visual quality

x264 = the old school standard encoder (which creates H.264 encoded content), decade of research and development and continual improvements
x265 = the new kid on the block encoder (which creates H.265 encoded content), improving very quickly but not there just yet and could have some big improvements in quality and speed in the very near future

Many don't understand that H.265 is a specification and x264 is merely an open-source best-attempt at making a H.265 encoder.

I'm sure that was just a typo of sorts there and you meant to say that x265 is merely an open-source best-attempt at making an H.265 encoder, since x264 is a very well established H.264 encoder and the standard one for a long, long time now. It's even used to create actual Blu-ray content in many instances as well.

Even at this stage in development of x265 for H.265 encodes, getting the files to be half the size of their respective x264/H.264 encoded versions is easy - making shit smaller is a piece of cake these days - but the visual quality isn't quite there yet. If you have a 1GB x264 encode of whatever material, getting it to half that size with x265 is quite simple but the visual quality won't be anything near what the 1GB x264 encode is capable of providing. As time passes and x265 matures, the visual quality will improve as well as the efficiency of the encoder itself (read: it'll work much faster), not to mention hardware encoders are now coming into existence as well to speed the process up even more.

It's just a question of maintaining the visual quality along with the smaller file sizes which is the balance that is difficult to have now with the still rather immature x265 encoder (and by immature I mean compared to x264).

But x265 is moving in, very fast, definitely.
 
You'll need some serious horsepower to encode everything in h.265. I think even the top of the line i7's currently are only getting 15 fps. Would take forever to convert a library.

And then we have Plex. Plex doesn't do a good job, currently, with h.265. Especially high bitrate 1080P content.

I'd wait until it matures a bit.
 
I'm good in the horsepower category. (three supermicro x8dte-f setups with quad xeons)
It'll take forever and a day to crunch through the 14TB library, but standardizing everything should be worth it.

Sad to hear that Plex doesn't play nicely with H.265 at the moment. I was debating about standardizing on H.264, I just don't want to convert everything just to have the next standard be the bees knees, you know?
 
I'm in the "IDGAF" crowd where it's not worth converting what I already have. I already have some high bitrate 1080P h.265 movies that don't play well with Plex. Now, if I have an end device that has the horsepower to play them, sure, plex will send the data no problem. But, transcoding on the fly with plex, nope.
 
You'll need some serious horsepower to encode everything in h.265. I think even the top of the line i7's currently are only getting 15 fps. Would take forever to convert a library.

And then we have Plex. Plex doesn't do a good job, currently, with h.265. Especially high bitrate 1080P content.

I'd wait until it matures a bit.

Hwa? I don't think so... Plex handles h.265 just fine, if the other end supports things it doesn't care what format the video is in, it just passes it along verbatim. The new (currently plex pass only) Plex Media Player software handles things just fine. I've got some h.265 content sitting on the plex box, the HTPC played back with zero video transcoding.
 
Hwa? I don't think so... Plex handles h.265 just fine, if the other end supports things it doesn't care what format the video is in, it just passes it along verbatim. The new (currently plex pass only) Plex Media Player software handles things just fine. I've got some h.265 content sitting on the plex box, the HTPC played back with zero video transcoding.

Most people aren't using HTPC's. An end device, like a Roku or FireTV doesn't have the power to handle high bitrate (20+ Mbps) h.265. All of my Star Wars movies are 20 Mbps h.265 1080P. Not a single one of my Roku's can handle it. Even my server with a E3-1225 v2 struggles, 100% cores loaded, and will buffer. If I pass it off to my PC it plays just fine.

Everything I've seen has Plex Server or the end device transcoding it to h.264. Unless there is a setting somewhere that I haven't found. I use Plex Pass as well and am on the latest server version.
 
Last edited:
H.265 will move in VERY quickly....much faster than H.264 did (first official was 2003). With how much media content is being streamed around the world...people in all aspects of the industry are begging for it and working on it. However, as stated above, the encoders are not mature yet but there is PROOF that it can do what it says it will do; cut file size in half at the same (or really really close) video quality.

H.264 took approximately 10 years to mature. H.265 was officially spec'd in 2013 I believe and in less than 2 years dedicated and low cost HW chips are already available. That is about 1/2 the time H.264 was. I would not be surprised to see widespread adoption within 2 years and good open source encoder within that same time frame.

But on that same token...If you have a H.264 library right now..keep it. It is about the best you can "freely do". But winter (H.265) is coming..and fast.
 
Last edited:
I have been playing around with NVENC using Mediacoder, note I am not using a registered version so all of the samples below are 1080p rather than 4K. NVENC was on my 980GTX

I used this test clip: Demo Ultra-HD - Muse 4K - Live in Rome

I've uploaded all of the test files here for people to look at
VIDEO TESTS (on onedrive)

I have compressed the following samples:
X265
X264
Nvenc h265 (@about 70fps encoding)
Nvenc h264

All of settings for the videos were roughly the same (ABR 4000Kbps, Very slow/high quality, 1080p) or as close as I could get.

YMMV, but NVENC H265 looks fine to me.

I should mention that emby media server can use gpus for transcoding

(EDIT: Links updated)
 
Last edited:
Maybe I will have to wait for Polaris, as it supposedly does H265 in hardware (encode & decode), even 10-bit, up to 4k.

Nvidia's 9x0 cards will already do this.

You'll need some serious horsepower to encode everything in h.265. I think even the top of the line i7's currently are only getting 15 fps.

Depends on your source material and the output settings. Very slow/placebo type settings will force i7s to do 2-3fps on x265, in contrast, on "very fast" my i7-5775C will do about 30fps (with the aforementioned clip)

Most people aren't using HTPC's. An end device, like a Roku or FireTV doesn't have the power to handle high bitrate (20+ Mbps) h.265. All of my Star Wars movies are 20 Mbps h.265 1080P. Not a single one of my Roku's can handle it.

I would love for you to send me a short (10-20 second) snippet of one of these to test on a Mini MX which I have - which supports hardware h265 and is available for $35 on ebay...


Lossy to Lossy will always look worse than Source -> Lossy. Going from H264 to H265 is going to net you a worse result than going BR -> H265 it's that simple.
 
Lossy to Lossy will always look worse than Source -> Lossy. Going from H264 to H265 is going to net you a worse result than going BR -> H265 it's that simple.

With only a few exceptions, blu-ray media is h.264 so that statement above is kinda meaningless.
 
With only a few exceptions, blu-ray media is h.264 so that statement above is kinda meaningless.

Agreed. Pretty much any BD released in the past 4-5 years will be H264, so I was a bit confused by the statement as well. I'm assuming maybe he meant re-encode -> H265 is worse than BD source -> H265 which is obviously true.

I have actually been converting some MPEG2 BD rips (and few VC1) to H264 just to get them out of the dated format. Using CRF 18 in handbrake with very slow presets, I can get them about 30-60% smaller with no noticeable drop in IQ. I'll be happy to jump to H265 once encoding efficiency has increased and decoding support has expanded.
 
Agreed. Pretty much any BD released in the past 4-5 years will be H264, so I was a bit confused by the statement as well. I'm assuming maybe he meant re-encode -> H265 is worse than BD source -> H265 which is obviously true.

I have actually been converting some MPEG2 BD rips (and few VC1) to H264 just to get them out of the dated format. Using CRF 18 in handbrake with very slow presets, I can get them about 30-60% smaller with no noticeable drop in IQ. I'll be happy to jump to H265 once encoding efficiency has increased and decoding support has expanded.

I've actually found that anything slower than "medium" just isn't worth it. Through some tests and a bunch of searching I found that it's only like single digit percentage points smaller than medium at like half speed or worse. CRF is another story though, that's more about personal taste. I tend to run CRF20 for my HDTV encodes and 24 for h.265 encodes.
 
Back
Top