Quantcast
Channel: Adobe Community : Popular Discussions - Encore
Viewing all articles
Browse latest Browse all 19186

If your x264 encoded 1080i 29.97 fps content keeps showing "untranscoded" read this.

$
0
0

I figured I would save someone else hours of pointless trial and error, which was my case yesterday, and tell you about my findings on encoding 1080 interlaced 29.97fps content with x264. I know there are many variants of it out there, but I'm talking about the original at http://www.x264.nl/x264_main.php and encoding using a .bat file instead of MeGUI or Handbrake or any other GUI for it. I mean, I still use MeGUI for some things because it's very useful, but there's an important reason why I'm not using it for the encoding itself, and it's because it uses Avisynth.

 

One thing I found out is that Avisynth sucks when used as the "middle man" between your footage file and x264, unless you use ffmsindex first. If, for example, your avs script looks like this:

 

AVISource("E:\x264BDTests\footage01.avi", audio=true).AssumeFPS(30000,1001)

#deinterlace

#crop

#resize

#denoise

 

ConvertToYV12()

 

Then your encode will look OK at first glance, but when you have takes that show areas with gradients, such as a spotlight shining onto a colored wall where you see different levels of luminosity, there's going to be a lot of banding, much worse than the original footage. There's always going to be some banding, first because of the color compression in the camera but also because your TV set has its own color compression. But using Avisynth will cause that color degradation to be much more noticeable, to the point where it looks almost like a solarization effect. And it's not because of the ConvertToYV12 line, if you use ConvertToRGB it's going to show the same exact awful degradation.

 

However, if you use the FFMS indexer (which you can choose when you load the avi file in MeGUI's AVS Script Creator) then your script will look something like this:

 

LoadPlugin("C:\Users\Sebastian\Programs\MeGUI_2525_x86\tools\ffms\ffms2.dll")

FFVideoSource("E:\x264BDTests\footage01.avi", fpsnum=30000, fpsden=1001, threads=1)

#deinterlace

#crop

#resize

#denoise

 

ConvertToYV12()

 

Then the encode will not have that color degradation. I don't know why this happens, as it's still an Avisynth script, so if Avisynth is still in the mix, the color degradation should still happen, but it doesn't.

 

However, there's an easier and better way, which is the point of my post, and it took me hours of trial and error (and forums research) to find out.

 

I wanted to bypass MeGUI and just use x264 in the command line, obviously using a batch file because I'm not going to waste time typing a string of parameters each time I need to encode something.

 

First off, you need to download the latest build of x264 from here: http://www.x264.nl/x264_main.php and make sure you download the "64bit 8bit-depth" version, unless you still have a 32 bit Windows, but most people don't. Don't use the 10 bit versions because those won't work for Blu-ray. For those who don't know, x264.exe is not an installer, it's a command line program, so you can download it to the same folder where you have your footage, and obviously your bat file has to be there too. Well, in theory it doesn't, but it will make things a lot easier.

 

Then I went to this website, which shows the best parameters to make each type of footage compatible with the Blu-ray specs:

 

http://www.x264bluray.com/

 

So it says that for encoding 1080i - 29.97 fps footage, these are the correct parameters:

 

1080i29.97 / 1080i30

 

x264 --bitrate XXXXX --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 30 --open-gop --slices 4 --tff --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 1 -o out.264 input.file

 

x264 --bitrate XXXXX --preset veryslow --tune film --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 30 --open-gop --slices 4 --tff --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --pass 2 -o out.264 input.file


If you don't want 2 pass encoding you just do one line and take out the --pass x parameter.


Now, doing tests encoding just one minute of footage I had one problem: if I used an Avisynth script as the source, the encoded file would load in Encore just fine, and show "Don't Transcode" under the Blu-ray transcode status column. However, if I executed x264 without using an avisynth script, but the avi file as source, the file would encode just fine, but in Encore it would show as Untranscoded.


The main advantage to using x264 by itself is that it doesn't load the file using avisynth, it has the FFMS indexer built into its code, so when executing the script, it indexes the avi file and starts encoding, so you don't have that horrible color degradation I mentioned above.


I spent hours doing several tests, changing parameters in the string, doing Google searches and whatnot, until I remembered about this useful little program called Media Info, which displays a lot of information about video files. I had stopped using it years ago because the installer started coming with prompts to install adware, but I found out there is a portable version that doesn't come with any of that.


So I opened two files in Media Info, a file encoded with x264 using an avs script as the source, both of which had been encoded with the exact same string of parameters, and I saw only one difference: the file encoded with x264 without using Avisynth wasn't showing the frame rate attribute, specifically:


Frame rate: 29.970 fps


So I went back to the x264 parameters wiki and found the one to specify frame rate, which in this case it would be --fps 29.97. Once I added that to my batch file, the encoded file loaded in Encore and it showed the "Don't Transcode" status. So my batch file looks like this:


x264.exe --bitrate 25000 --preset slow --tune film --bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 30 --open-gop --slices 4 --tff  --range tv --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --fps 29.97 --sar 1:1 -o E:\x264BDTests\footage01.264 E:\x264BDTests\footage01.avi


Of course you can always modify some parameters, using --preset veryslow if you have a lot of time to wait, or removing the --preset parameter altogether if you want a fair quality/encoding time trade-off. You might want a different bitrate, or doing two passes instead of one. You may also need to change --tff to --bff if your interlaced footage is lower field. But no matter what, if it's 29.97 interlaced footage, make sure you always include the --fps 29.97 parameter. And perhaps Europeans have to include --fps 25 as well, I didn't test any PAL footage because I don't have any.


For those of you who never used a command line batch file before, you just open Notepad, copy the string above, modify it per your needs, then save the file with a bat extension, such as encode.bat. Then, on the window where you have x264, you press shift and right click at the same time, choose "Open command window here" which will open a command line window. Type encode, then enter, and that's it.


Many people here probably know all this already, but I hope I saved somebody else some time.


Sebastian Alvarez


 


Viewing all articles
Browse latest Browse all 19186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>