lisamelton / video_transcoding

Tools to transcode, inspect and convert videos.
MIT License
2.39k stars 160 forks source link

2160p (4k) input resolution #246

Closed rdavid closed 5 years ago

rdavid commented 5 years ago

Hello Don,

I didn't find any information on 2160p (4k).

What will be target bitrate for 2160p input resolution? What are the best settings to keep most of 2160p beauty for 4k TV?

For years I've been using following settings (I have bash wrapper for multiple files):

  transcode-video --no-log \
                  --m4v \
                  --main-audio ${AUD[$i]} \
                  --burn-subtitle ${SUB[$i]} \
                  --preset veryslow \
                  --output /home/david/ ${FIL[$i]}

Thank you for the tool, I have dedicated FreeBSD host to run it 24/7, David

khaosx commented 5 years ago

@rdavid - While I cant speak to the technical part of your question, you’re going to want to think hard about whether or not you want to do this for movies that are 4K with any HDR. You’ll lose all that information during the transcode, and the resulting video is going to be really washed out and probably not the quality you’re looking for.

lisamelton commented 5 years ago

@rdavid You are very welcome for the tools! Thanks for using them. And giving them a workout on FreeBSD!

I intentionally don't include information on 2160p or 4K video in my documentation because most users don't have rips at that resolution and because most probably don't want to spend the significant time it takes to transcode them if they do. And then there's the problem of playback since many devices don't support it.

But the target bitrate is exactly twice that of 1080p, i.e. for 2160p it's 12000 Kbps.

As @khaosx mentioned, HDR output is a concern. If your input is HDR then to maintain that in your output you should consider using one of the 10-bit encoders, e.g. by adding --encoder x264_10bit or --encoder x265_10bit to your command line.

But be careful using the x264_10bit encoder because there are very few devices except desktop computers that support it for playback.

And be warned using the x265_10bit encoder since it's even slower than the regular x265 encoder.

I hope that helps.

rdavid commented 5 years ago

@khaosx @donmelton Thank you, --encoder x265_10bit is added, we'll see a result in 56 hours (i7-3770 CPU @ 3.40GHz) :-)

lisamelton commented 5 years ago

@rdavid Yeah, that sounds like the right ETA. :) But I'm glad that helped. Let us know how it goes.

Are you OK with me closing this now?

rdavid commented 5 years ago

@donmelton At some point x265_10bit ETA was changed to hundreds of hours, I've stopped it. Now it is converting with x264_10bit. ETA is 66 hours. It is 89GB image of «Schindler's List».

Yes, please, close the issue. Thank you for the quick response.

lisamelton commented 5 years ago

@rdavid Yikes! Well, I didn't expect it to be quite that slow. But it's certainly not worth taking a week.

BTW, the "Schindler's List (1993)" Blu-ray is a bit problematic for my default ratecontrol system, especially for chapter 15. You might get better results using the --abr option.

Closing this now but feel free to keep commenting.

rdavid commented 5 years ago

@donmelton My last x264_10bit experiment on «Schindler's List» interrupted after 2 days of running—electricity issue (there is UPS but there is no generator!). Conversion of «Schindler's List» with following settings took 35 hours:

  transcode-video --no-log \
                  --m4v \
                  --main-audio ${AUD[$i]} \
                  --burn-subtitle ${SUB[$i]} \
                  --preset veryslow \
                  --output /home/david/ ${FIL[$i]}

Original 89GB are compressed to 17GB. The result looks nice to me at iMac Retina. It is black and white at the end :-)

Now I'm starting conversion of the same source with following:

  transcode-video --no-log \
                  --m4v \
                  --encoder x264_10bit \
                  --abr \
                  --main-audio ${AUD[$i]} \
                  --burn-subtitle ${SUB[$i]} \
                  --preset veryslow \
                  --output /home/david/ ${FIL[$i]}

What result should I expect besides long conversion time? What does 10bit configuration do? I didn't find any information regarding the flag in the help.

Thank you.

lisamelton commented 5 years ago

@rdavid The 10-bit encoders are capable of retaining high dynamic range (HDR) information, i.e. a wider color gamut. And even if your display isn't HDR capable, they can reduce color banding.

Good luck on the next one!

tehbdg commented 5 years ago

Hi all,

I thought I might comment on using x265 to compress 4k/UHD and 1080p BluRay source material using Dons video_transcoding tool.

The PC I am currently using for compression is an i7 6700. I am living overseas and the server I usually use, which is a dual Xeon e5-2650, is in storage. I am finding that the two rigs offer similar performance. The i7 6700 is running Windows 10 and the installation of the video_transcoding tool is installed using Docker

I am currently compressing 2001: A Space Oddisey from 4K using the settings: transcode-video --simple --burn-subtitle scan --handbrake-option encoder=x265_10bit . I am getting an average of 3.12 frames per second which is about 1/8 of the frame rate of the movie, so it will take 8 hours per hour of the movie. That will work out to be 17-18 hours to compress.

When the movie finishes compressing, I will remux the original sound files and subtitles back into the file. The reasons I do this are because although my current receiver doesn't support things like Atmos and DTS-X, (in fact my receiver is in storage as well), I will definitely be upgrading to one when I move back home. When I do, I don't want to be looking at files I spent nearly 24 hours encoding wondering why I don't have Atmos. The other reason is storage is cheap and upgradeable. Adding an extra few gigabytes of sound to an encode is not important to me if I can keep throwing hard drives into the server.

I have encoded about 30 4k movies using this method (adding the -simple switch when it became available), and to my highly scientific eye, the picture quality is non-discernable from the original content, except on very dark scenes where banding appears.

As to encoding 1080p BluRay using the same settings and comparing to some older handbrake encodes, the h265 is much better looking and in most cases quite a bit smaller.

I am using Plex to serve all my files, with multiple clients including

The 4k encoded files will only play on the PCs and the Chromecast ultra. My crappy little i3 server just doesn't have the grunt to transcode from 4k to 1080p. I have lately started doing a second encode using handbrake GUI 4k to 1080p using H.265 10 bit to mkv, which plays on everything else in the house.

As to HDR content, nothing in my house supports it and it looks terrible. It looks fine on the LG 4k tv through the Chromecast Ultra, but there was a lot messing around with the config to get there. Again I am not concerned with this as there will be HDR TVs in the future. It is actually reassuring to see that the HDR content is being preserved in the encoding.

Sorry about the long comment. I hope my experiences will help someone else

lisamelton commented 5 years ago

@tehbdg Thank you so much for the comment! Length and all. Seriously.

I'm glad you're using the --simple option for HEVC transcoding. That's tuned better than the default ratecontrol system for HEVC.

And I really admire your patience with this! I'm not sure I could do that.

tehbdg commented 5 years ago

@donmelton Thanks so much. This is my first time ever commenting in a public forum. I suffer from pretty severe anxiety, so it was quite a feat.

I absolutely love using your tools and am quite in awe of your technical abilities, perseverance, and patience. I am finding the video_transcoding tool to be indispensable as it is giving me what I would call archival level of quality. When I get back to my server I am planning on running a docker instance on top of unraid alongside Plex and a few other tools and hopefully automating the process. However, that is a year away so I will hack around with what I have.

Thanks so much.

lisamelton commented 5 years ago

@tehbdg I'm so glad you're not shy! My sympathies for your anxiety issue. But maybe you can find strength in that with your own very impressive perseverance and patience.

And you are very welcome for tools! I'm always amazed that other people find them useful.

Once you do get around to automating that process, feel free to open an issue here and tell us all about it. I know I would find it fascinating.

Cheers!

callmescam commented 5 years ago

Thanks to all for this thread. I nearly started on my 4K transcoding journey today but decided to research first before taking the plunge. I will wait for now because I have neither the technical expertise, nor the patience, of @tehbdg. Furthermore, my Mac Mini is not quiet up to snuff for that task.

@donmelton Thank you for the fantastic tools. I'm very grateful for the simplicity of it since I am not as technically savvy as some of your other users.

lisamelton commented 5 years ago

@callmescam You are very welcome! Although you already must be technically savvy to use the command line, so don't disparage yourself.

rdavid commented 5 years ago

Continuing to report on «Schindler's List» saga. Following settings took 56 hours:

transcode-video --no-log \
                  --m4v \
                  --encoder x264_10bit \
                  --abr \
                  --main-audio ${AUD[$i]} \
                  --burn-subtitle ${SUB[$i]} \
                  --preset veryslow \
                  --output /home/david/ ${FIL[$i]}

Original 89GB are compressed to 17GB, similar to conversion without 10 bits. Surprisingly QuickTime players doesn't recognise resulted file. VLC does, I'll check with Plex later.

Started another run with settings recommended by @tehbdg :

  transcode-video --no-log \
                  --m4v \
                  --handbrake-option encoder=x265_10bit \
                  --simple \
                  --main-audio ${AUD[$i]} \
                  --burn-subtitle ${SUB[$i]} \
                  --preset veryslow \
                  --output /home/david/ ${FIL[$i]}

Meanwhile ETA is 60 hours.

Thank you all for the discussion.

tehbdg commented 5 years ago

Hi @rdavid . I don't think I am using the very slow preset unless it defaults automatically.

lisamelton commented 5 years ago

@rdavid It could be that the notoriously picky QuickTime app expects some special metadata in the MP4 output that HandBrake is not including. Has this kind of thing happened before?

BTW, VLC and mpv are essential utilities because they'll play anything. Including files that don't actually contain media. :)

lisamelton commented 5 years ago

@tehbdg The default preset in transcode-video is "medium," just like the default in x265 itself.

rdavid commented 5 years ago

@donmelton QuickTime always OK with followings:

  transcode-video --no-log \
                  --m4v \
                  --main-audio ${AUD[$i]} \
                  --burn-subtitle ${SUB[$i]} \
                  --preset veryslow \
                  --output /home/david/ ${FIL[$i]}

Probably x264_10bit caused some metadata incompatibility.

The computer doesn't like x265_10bit, after 48 hours running ETA is 1710 hours, similar to last try with the settings. Which is weird. I'm stopping the conversion.

lisamelton commented 5 years ago

@rdavid Thanks! I didn't realize QuickTime had a problem with the x265_10bit encoder. Sorry that your computer doesn't like it either.

rdavid commented 5 years ago

@donmelton x264_10bit flag caused a problem to QuickTime, without 10bits hundreds of conversion were fine, 4k included.

x265_10bit causes extremely slowness to the computer.