logo Sign In

Info: Encoding tips and ideas

Author
Time
 (Edited)

Please post your ideas, hints and tips for encoding here. We would like to hear how you encode with x.264 h.264 encoding.

Please post examples and screenshots. This is not for a debate about what is better. It is about how to get good results for various projects.

Team Negative1

Author
Time

To make a Blu-ray compliant encode at excellent quality, these are the only settings you need. This will likely produce an encode larger than BD-25 with audio included. Note, this assumes your source material has already been converted to YV12 4:2:0.

–profile high --preset placebo --level 4.1 --bluray-compat --crf 16 --deblock -3:-3 --aq-strength 0.7 --no-mbtree

If you are aiming for BD-25 you should use 2-pass encoding instead of CRF in order to take full advantage of the space available. You can use various bitrate calculators to determine within a small margin of error what your target bitrate will need to be to hit the size constraint with any audio and subtitle tracks included. I recommend the calculator included with MeGUI as it can be configured to take into account overhead of various video and audio containers.

Author
Time

OK. As promised here is the first round of encoding tests. This test uses footage from the start of the film where the Tantive is swallowed up and we first see 3P0 and R2. I will also try the same tests on a desert scene, a cantina scene and maybe a battle of Yavin Scene if time permits.

First Download the source file, a 1.8 GB 59 second clip Pro Res Quicktime:

http://we.tl/OpnATUbsDZ

This is not a re-encode of the MKV that was released - this is straight from the master. (I don’t have the full master, yet, just some clips to test with)

And then compare it to the encoded files here:

http://we.tl/lHuDPvG6Aj

Let’s start with the settings we used for our MKV.

StarWars_Opening_TN1.m4v

Encoded with a recent build of ffmpeg using a command very similar to this one (here the audio is ommitted):

ffmpeg -i G:\Uploads\FullRez_SilverScreenClips\StarWars_Opening.mov -c:v libx264 -level 4.0 -pix_fmt yuv420p -preset veryslow -tune grain -crf 19 -g 24 -threads 6 -x264opts bluray-compat=1:vbv-bufsize=20000:vbv-maxrate=30000 -an -y “G:\Uploads\FullRez_SilverScreenClips\tests\StarWars_Opening_TN1.m4v”

Next up: StarWars_Opening_Ru08.m4v

If I recall correctly, RU.08 simply wanted us to use the same settings, but make the CRF value 16, I apologize if there were other tweaks suggested by RU.08 that I missed, but that seemed to be the main change being requested:

ffmpeg -i G:\Uploads\FullRez_SilverScreenClips\StarWars_Opening.mov -c:v libx264 -level 4.0 -pix_fmt yuv420p -preset veryslow -tune grain -crf 16 -g 24 -threads 6 -x264opts bluray-compat=1:vbv-bufsize=20000:vbv-maxrate=30000 -an -y “G:\Uploads\FullRez_SilverScreenClips\tests\StarWars_Opening_Ru08.m4v”

Next: StarWars_Opening_Jan.264

Jan sent us to this page: http://www.x264bluray.com/home/1080i-p so those are the settings I tried:

x264-64.exe --bitrate 24000 --preset veryslow --tune grain --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --open-gop --slices 4 --colorprim “bt709” --transfer “bt709” --colormatrix “bt709” --sar 1:1 --pass 1 -o “G:\Uploads\FullRez_SilverScreenClips\tests\StarWars_Opening_Jan.264” G:\Uploads\FullRez_SilverScreenClips\StarWars_Opening.mov && “d:\Firefox Downloads\x264-64.exe” --bitrate 24000 --preset veryslow --tune grain --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --open-gop --slices 4 --colorprim “bt709” --transfer “bt709” --colormatrix “bt709” --sar 1:1 --pass 2 -o “G:\Uploads\FullRez_SilverScreenClips\tests\StarWars_Opening_Jan.264” G:\Uploads\FullRez_SilverScreenClips\StarWars_Opening.mov

Chouonsoku. This command produced my own personal preference. Now that Chouonsoku has a good source clip perhaps this can be tweaked more, but even as is, it produces a very fine looking clip in my opinion, also one of the smaller ones, and fastest encodes. So unless anyone can find a frame where this encode looks worse than all the others, this is probably the way we’ll go with future encodes.

StarWars_Opening_Chouonsoku.264 was created using this command:

x264-64.exe --level 4.1 --bluray-compat --preset veryslow --bitrate 24000 --deblock -2:-2 --open-gop --slices 4 --ipratio 1.2 --pbratio 1.2 --vbv-bufsize 30000 --vbv-maxrate 40000 --qcomp 0.7 --no-mbtree --psy-rd 1.10:0 --no-dct-decimate --no-fast-pskip --colorprim bt709 --transfer bt709 --colormatrix bt709 --aq-mode 3 --pass 1 -o “G:\Uploads\FullRez_SilverScreenClips\tests\StarWars_Opening_Chouonsoku.264” G:\Uploads\FullRez_SilverScreenClips\StarWars_Opening.mov && “d:\Firefox Downloads\x264-64.exe” --level 4.1 --bluray-compat --preset veryslow --bitrate 24000 --deblock -2:-2 --open-gop --slices 4 --ipratio 1.2 --pbratio 1.2 --vbv-bufsize 30000 --vbv-maxrate 40000 --qcomp 0.7 --no-mbtree --psy-rd 1.10:0 --no-dct-decimate --no-fast-pskip --colorprim bt709 --transfer bt709 --colormatrix bt709 --aq-mode 3 --pass 2 -o “G:\Uploads\FullRez_SilverScreenClips\tests\StarWars_Opening_Chouonsoku.264” G:\Uploads\FullRez_SilverScreenClips\StarWars_Opening.mov

and I also doubled the bit-rate to see what this would look like on a BD 50 for StarWars_Opening_Chouonsoku_DL.264:

x264-64.exe --level 4.1 --bluray-compat --preset veryslow --bitrate 40000 --deblock -2:-2 --open-gop --slices 4 --ipratio 1.2 --pbratio 1.2 --vbv-bufsize 30000 --vbv-maxrate 40000 --qcomp 0.7 --no-mbtree --psy-rd 1.10:0 --no-dct-decimate --no-fast-pskip --colorprim bt709 --transfer bt709 --colormatrix bt709 --aq-mode 3 --pass 1 -o “G:\Uploads\FullRez_SilverScreenClips\tests\StarWars_Opening_Chouonsoku_DL.264” G:\Uploads\FullRez_SilverScreenClips\StarWars_Opening.mov && “d:\Firefox Downloads\x264-64.exe” --level 4.1 --bluray-compat --preset veryslow --bitrate 40000 --deblock -2:-2 --open-gop --slices 4 --ipratio 1.2 --pbratio 1.2 --vbv-bufsize 30000 --vbv-maxrate 40000 --qcomp 0.7 --no-mbtree --psy-rd 1.10:0 --no-dct-decimate --no-fast-pskip --colorprim bt709 --transfer bt709 --colormatrix bt709 --aq-mode 3 --pass 2 -o “G:\Uploads\FullRez_SilverScreenClips\tests\StarWars_Opening_Chouonsoku_DL.264” G:\Uploads\FullRez_SilverScreenClips\StarWars_Opening.mov

Finally, I also tested out an older version of Cinemacraft HDe (ver 1.14.02.00, built in Nov 2011). From what I have read on the internet (so it must be true), Cinemacraft HDe may have been bought by Sirius Pixels. In any case, StarWars_Opening_CCHDe_3_pass was produced using this build, as a 3 pass VBR encode with an average bitrate of 24000 to match that of StarWars_Opening_Chouonsoku.264 for a fair comparison.

CCHDe was also the fastest encode despite making 3 passes, but that could have been because it only works with uncompressed sources.

Anyway, as time permits I will encode and upload some more scenes for you to examine with your magnifying glasses, and look forward to reading your conclusions.

For the less technically savvy who would also like to check these clips out, I recommend you download the Combined Community Codec Pack which will install a player called Media Player Classic Home cinema, that will play the .264 files nicely. On my system, I found Windows Media Player could also play them, but they were sped up.

For the source clip you will need Quicktime Player and possibly the Pro-Res decoder for windows

After all the belly aching about the original Encode* I expect to see page after page of magnified screen comparisions pushing for your favorite settings, otherwise we’re just going to take Chouonsoku’s advice and ignore the rest of you 😃

  • Which were all valid points

TheStarWarsTrilogy.com.
The007Dossier.com.
Donations always welcome: Paypal | Bitcoin: bc1qzr9ejyfpzm9ea2dglfegxzt59tys3uwmj26ytj

Author
Time

Good job on all the testing. We hope people will look at them and run their own tests.

Thanks for all the advice from people.

Team Negative1

Author
Time

Will the upcoming 1.1 release be re-encoded using these settings? Or will these settings only be applied to other releases.

Author
Time
 (Edited)

Thanks for doing these samples. It really is nice to see it uncompressed, first of all.

I’m not sure I have the best eye for comparing the various encodes, but as no one else has chimed in yet: the Chouonsoku option really does look quite nice. I loaded them into editing softare so that I could throw them on a timeline and flip through the various layers to compare and look more closely. Very clear reduction in macroblocking (or whatever the appropriate term is). And the DL version does indeed appear to be a bit nicer. When looking at high magnification, it appears that the difference between DL and lossless is lesser than the difference between SL and DL.

I really can’t say whether or not the other samples are better than TN1’s previous encode. The compression artifacts look different, but I don’t know if there is a net reduction.

Would be interested in seeing some more samples of Chouonsoku vs. lossless. Maybe a very high grain shot or two, like something including a wipe? (Luke hopping in his speeder and returning ‘home’, ‘Scum and villainy’ with wipe and speeder shot, lightsaber duel, perhaps?).

I’m glad you’re entertaining the idea of the DL route. It really does look great. Another reason to consider a high bitrate encode is that people are already considering using footage from your releases in their own projects. Not everyone will be able to get lossless files like Harmy might, so it really would help against generational losses. Obviously not your primary concern. But many people clearly see your release as their go-to and favorite version, so it would be nice if the release was as definitive and final as possible.

Author
Time
 (Edited)

One silly/naive question: when producing encodes for standalone viewing (as opposed to burning to disc), why bother to encode the full 1920x1080 (or 1280x720)? Why not just encode the “active” image area (1920x820 or 1280x546)? I find that any viewer that I care to use (VLC on PC, BSplayer on tablet/phone, built-in player on my Bluray player) can handle the file and readd the black bars on its own.

Author
Time

The 1.1 version will probably not be re-encoded. We are still testing it out.

However the BD version will definitely be re-encoded.

Team Negative1

Author
Time

team_negative1 said:

The 1.1 version will probably not be re-encoded. We are still testing it out.

However the BD version will definitely be re-encoded.

Team Negative1

Will the BR version come out as an MKV for those of us who don’t/can’t burn physical discs? Also, will there be a BD50/50 GB release for those who want ultra-high quality for projection or as a source for further projects?

Author
Time
 (Edited)

madcrow said:

team_negative1 said:

The 1.1 version will probably not be re-encoded. We are still testing it out.

However the BD version will definitely be re-encoded.

Team Negative1

Will the BR version come out as an MKV for those of us who don’t/can’t burn physical discs? Also, will there be a BD50/50 GB release for those who want ultra-high quality for projection or as a source for further projects?

It can always be remuxed or played from the m2ts.

As for the latter, I hope so. The benefit has been demonstrated in this thread. While Rob fortunately seems to be entertaining the idea, whoever is using the team account at the moment hasn’t swayed yet, as their newly described ‘vs’ project is also only planned for 25gb.

Author
Time

+1 on the crop for the MKV version. While the black parts don’t waste much bitrate, cropping it out will eliminate possible issues with the image around the borders during the encoding process. It will also be beneficial to anyone watching on an Ultrawide/2.35:1 setup

Author
Time

madcrow said:

One silly/naive question: when producing encodes for standalone viewing (as opposed to burning to disc), why bother to encode the full 1920x1080 (or 1280x720)? Why not just encode the “active” image area (1920x820 or 1280x546)? I find that any viewer that I care to use (VLC on PC, BSplayer on tablet/phone, built-in player on my Bluray player) can handle the file and readd the black bars on its own.

Full-frame HD images retain the flexibility for those of us who do like to burn to disc. If you crop, that isn’t possible, and this isn’t true of the reverse (media player folks can handle pretty much anything, bars or no).

Wanting to maximise the encode is perfectly understandable, of course (and I’m certainly envious of anyone who can project a true 2.35:1 image in a fixed height setup without transcoding). Once these encoding specifics have been worked over, perhaps there’s mileage in releasing both cropped MKVs and BD (or at least, BD compliant) images.

By the way, I’d be interested to see the balance of folks using media centres vs. those still playing from disc. Maybe we could do a poll or something - might help indicate demand to the nice people making these projects.

Author
Time

Anecdotally, it seems like there are a lot of each type of viewer here. For anything that has ever been released cropped, there have been disappointed members soon er or later realizing that their download must be reencoded to burn.

This thread is the first I’ve seen of the anti bar (pro crop) viewpoint. I was under the impression that it has virtually no impact on compression but that might be incorrect.

Author
Time

The flexibility argument makes sense. By the way, what sort of bitrates and options would work if I wanted to make a 720p version that fits on a DVD-9 as a “fake” (AVCHD) Bluray. I tried doing a 2 pass encode through Handbrake at 8900 kbps and while the resulting file looks great (certainly better than HD from Netflix), the resulting data doesn’t fit on a DVD after being run through tsmuxer. How low can you go before things start looking like crap? Is it possible to go down to 4000 or so and fit on a DVD-5? I’ve currently just burned the raw MKV of my 720p encode to a DL DVD, but I understand that an AVCHD-format disc might have better compatibility with hardware players.

Author
Time

madcrow said:

The flexibility argument makes sense. By the way, what sort of bitrates and options would work if I wanted to make a 720p version that fits on a DVD-9 as a “fake” (AVCHD) Bluray. I tried doing a 2 pass encode through Handbrake at 8900 kbps and while the resulting file looks great (certainly better than HD from Netflix), the resulting data doesn’t fit on a DVD after being run through tsmuxer. How low can you go before things start looking like crap? Is it possible to go down to 4000 or so and fit on a DVD-5? I’ve currently just burned the raw MKV of my 720p encode to a DL DVD, but I understand that an AVCHD-format disc might have better compatibility with hardware players.

After a certain point, going lower in bitrate while maintaining the same resolution will result in worse quality than just dropping the resolution. e.g. 480p @ 4Mbps might look better than 720p @ 4Mbps. With something as grainy as Star Wars, I’d recommend sticking to 480p resolution if you have to use a DVD-5. On DVD-9 720p should still be reasonable, you may just need to play with the bitrate a bit to get it to fit. All of this is a bit moot when using Handbrake though, which can produce some pretty terrible looking encodes. I recommend MeGUI if you need a “wizard” to help you through it.

On the topic of cropping vs. not cropping, it all comes down to how many encodes TN-1 are willing to produce. I don’t know the logistics behind their setup, but you’ve gotta keep in mind that there is more than one project to be worked on and that each additional encode adds a lot of render time. In a perfect world, I think TN-1 should offer two options:

  1. Full BD-50 format 1080p encode with any audio tracks planned.
  2. BD-25 sized 1080p MKV, cropped, with any audio tracks planned.
  3. Chotab’s Dream Sequence: 2160p, x264 encoded @ ~85-100 Mbps, cropped.

Ignore 3, I was just daydreaming a bit. 😉 Anyway, between options 1 and 2 you have a lot of your bases covered. You’ve got the disc crowd and the encode crowd happy, at least the 1080p users. The only people not covered are those that want 1080p at lower bitrate which they can transcode themselves from either 1080p release or lower resolution which works the same way. I personally think it’d be a waste of time for the team to make AVCHD format releases, 720p, etc. because if we have to pick and choose I would prefer only the highest quality offerings that the other formats can be created from at our leisure.

Author
Time

Chouonsoku said:

  1. Full BD-50 format 1080p encode with any audio tracks planned.
  2. BD-25 sized 1080p MKV, cropped, with any audio tracks planned.

Sounds like this would be a great plan. I know at least one member of TN1 disagrees with me, but I imagined the demographic with blu-ray burners but not DL blu-ray burners would be virtually non-existent. I suppose it could be the case for early adopters of the format, though.

Author
Time

There are no current plans for anything higher than 25G encodes, due to the time, planning, and distribution of those files. Even little fixes, takes us lots of time to upload, download, and re-encode.

Also, if you have the bluray files, you can demux the .m2ts files and make your own versions from that.

Team Negative1

Author
Time

Chouonsoku said:

After a certain point, going lower in bitrate while maintaining the same resolution will result in worse quality than just dropping the resolution. e.g. 480p @ 4Mbps might look better than 720p @ 4Mbps. With something as grainy as Star Wars, I’d recommend sticking to 480p resolution if you have to use a DVD-5. On DVD-9 720p should still be reasonable, you may just need to play with the bitrate a bit to get it to fit. All of this is a bit moot when using Handbrake though, which can produce some pretty terrible looking encodes. I recommend MeGUI if you need a “wizard” to help you through it.

I use Linux, so MeGUI isn’t an option. X264’s commannd line options are pretty straight forward, but I’ve never had a problem with Handbrake before so I haven’t learned them. As for size, when I did a CRF 20 encode I got a 5.5 GB file that looked great at 720p. It was only when I found that the lousy FAT32 file system used by USB sticks won’t hold the file that I started looking at making an AVCHD disc. Maybe I could try making an AVCHD structure on USB, though I’m not sure how many players can handle such a beast. As for 480p, I didn’t think that was legal for AVCHD.

On the topic of cropping vs. not cropping, it all comes down to how many encodes TN-1 are willing to produce. I don’t know the logistics behind their setup, but you’ve gotta keep in mind that there is more than one project to be worked on and that each additional encode adds a lot of render time. In a perfect world, I think TN-1 should offer two options:

  1. Full BD-50 format 1080p encode with any audio tracks planned.
  2. BD-25 sized 1080p MKV, cropped, with any audio tracks planned.
  3. Chotab’s Dream Sequence: 2160p, x264 encoded @ ~85-100 Mbps, cropped.

Ignore 3, I was just daydreaming a bit. 😉 Anyway, between options 1 and 2 you have a lot of your bases covered. You’ve got the disc crowd and the encode crowd happy, at least the 1080p users. The only people not covered are those that want 1080p at lower bitrate which they can transcode themselves from either 1080p release or lower resolution which works the same way. I personally think it’d be a waste of time for the team to make AVCHD format releases, 720p, etc. because if we have to pick and choose I would prefer only the highest quality offerings that the other formats can be created from at our leisure.

Indeed, I don’t think that TN1 needs to do all the subencodes. They just need to provide a good file that can be used as a source for other people. That’s why the “no 50 GB version” stance is so disappointing.

Author
Time

madcrow said:
I use Linux, so MeGUI isn’t an option. X264’s commannd line options are pretty straight forward, but I’ve never had a problem with Handbrake before so I haven’t learned them. As for size, when I did a CRF 20 encode I got a 5.5 GB file that looked great at 720p. It was only when I found that the lousy FAT32 file system used by USB sticks won’t hold the file that I started looking at making an AVCHD disc. Maybe I could try making an AVCHD structure on USB, though I’m not sure how many players can handle such a beast. As for 480p, I didn’t think that was legal for AVCHD.

What are you using the USB for? Instead of burning a disc for playback on a BD Player or to transfer to another PC? If you’re transferring to another PC you could get around the 4GB file size limit of FAT32 by creating a multi-part RAR archive. As I work in IT I know better than to suggest you format the USB as NTFS! 😉 If you’re using the USB instead of burning a disc for playback on a BD Player than I don’t know what to suggest, sorry.

Original Trilogy in Replica Technicolor Project
Star Wars PAL LaserDisc Project

Author
Time

The purpose of either the disc or the USB stick would be something that could be put into a BluRay player and watched on TV.

Author
Time

The purpose of either the disc or the USB stick would be something that could be put into a BluRay player and watched on TV.

Author
Time

First off, Im new to this forum and I would like to give a big thanks to TN1 for their labor of passion and most definitely of patience. I cant imagine maintaining the same level of patience and discipline in restoring over 170,000 frames throughout! Thats amazing. Secondly, yalls knowledge of video authoring and what not is light years ahead of my own. Can anyone provide a link or give me a push in the right direction as to how to get the MKV file to a file type that I can import into an editor and burn to BD? Ive tried one convert and it looks horrible. I really want to have a BD with the artwork that I can watch on my projection screen. Thanks!

Author
Time
 (Edited)

BobaJett said:

First off, Im new to this forum and I would like to give a big thanks to TN1 for their labor of passion and most definitely of patience. I cant imagine maintaining the same level of patience and discipline in restoring over 170,000 frames throughout! Thats amazing. Secondly, yalls knowledge of video authoring and what not is light years ahead of my own. Can anyone provide a link or give me a push in the right direction as to how to get the MKV file to a file type that I can import into an editor and burn to BD? Ive tried one convert and it looks horrible. I really want to have a BD with the artwork that I can watch on my projection screen. Thanks!

tsmuxerGUI.