h264 tips and tricks at DVinfo.net
DV Info Net

Go Back   DV Info Net > Windows / PC Post Production Solutions > What Happens in Vegas...
Register FAQ Today's Posts Buyer's Guides

What Happens in Vegas...
...stays in Vegas! This PC-based editing app is a safe bet with these tips.

Reply
 
Thread Tools Search this Thread
Old June 21st, 2012, 09:51 PM   #1
Trustee
 
Join Date: Jun 2004
Location: Denver, Colorado
Posts: 1,891
h264 tips and tricks

X264
It would seem an unlikely alliance, the Sony PMW350K 2/3" XDCAM and the Panasonic TM900 1/4" 3CMOS. How would you optimize their strengths on the same time line? For Panasonic, that's the AVCHD 2.0 spec for 1080/60p. For Sony, it's 1080/30p. But what if it was more than just those two? If you have Vegas Pro 11, it turns out it's really easy with a free plugin from AVID for DNxHD, and the free standalone command line x264 encoder.

Neither add on is essential, but together you can enhance the output quality in several important respects. What if you wanted to combine two or more progressive frame rates and add some interlace in there as well, and have it all look great when played back from a Blu-ray disk? Through project property, rendering and timeline event settings, all the switches you need are within Vegas but at the end of the preparations awaits very limited options from the rendering codecs. Blu-ray presents its own additional limitation in that it has no support for 1080/30p/60p. All of that beautiful progressively shot footage, what a shame to interlace it with artifacts like aliasing and moire, or see its output resolution take a 15% hit on quality. X264 has the answer. You encode it all as progressive frames yet flag them as interlace. The Blu-ray compliant decoder on the target machine thinks it's getting fields when they are actually full progressive frames, played out to the HDTV at 29.97 frames/sec.

In this example, you start by dropping your mixed frame rates onto the timeline. For each clip, set the event properties for 'no resampling,' and uncheck 'maintain aspect ratio.' Next, set your project properties to 1920x1080, 1:1 pixel, 29.97, progressive frames. Check the box for 'adjust source to better match project/rendering properties.' Choose 'blend' as the deinterlacing method. Under the ruler tab, select '29.97 drop frame.'

If you have installed the AVID DNxHD plugin, you choose 'R709, 1080/59.94i 220 mbps 8 bit codec' and in the dialog box you change it to 29.97 progressive frames and render out your intermediate.

Next up, the fantastic x264 encoder. You feed it the DNxHD intermediate file with the parameter, '--fake-interlace'. Choose 1 or 2 pass, you will not beat the output quality of this encoder at any bit rate. You now have a blu-ray compliant h.264 progressively shot and encoded file that is the source for your blu-ray authoring application de jour, multiAVCHD, tsMuxer or whatever, just make sure whatever you use does not re-encode your x264 file. Mux in your 5.1 AC3 audio at this time. Author and burn to disk.

That's the basics. If there is interest in this, I can answer more specific questions in greater detail.
Tom Roper is offline   Reply With Quote
Old June 21st, 2012, 10:14 PM   #2
Trustee
 
Join Date: Oct 2009
Location: Central Coast Australia
Posts: 1,046
Re: h264 tips and tricks

Sounds great, is there a GUI for the x264 encoder, or is it CL only?
__________________
http://vimeo.com/livewebvideo
Gerald Webb is offline   Reply With Quote
Old June 22nd, 2012, 10:15 AM   #3
Inner Circle
 
Join Date: Sep 2003
Location: Portland, Oregon
Posts: 3,420
Re: h264 tips and tricks

Handbrake is a GUI for x264. It adds the excellent yadif deinterlace and lanczos resize methods, too (not needed for the workflow above, but VERY handy and state-of-the-art for other workflows, esp. for internet distributions). You do need to have some familiarity with h.264 levels, profiles, bitrates, AAC, etc. to get best use of it, but you'd need that with the command-line encoder, too. You can also add x264 CL strings to a text box in the GUI for exotica HB doesn't do natively.

Unfortunately it doesn't ingest every common DI codec you'd want it to. I've had good results with Sony MXF. My memory is spotty on this, but I think I had problems with DNxHD, though, *if* I remember, there is a fix.

I haven't tested Tom's methods with HB... but thanks for the workflow pointers! This info looks applicable to many situations in which you have mixed footage, or need progressive and interlaced distributions.
__________________
30 years of pro media production. Vegas user since 1.0. Webcaster since 1997. Freelancer since 2000. College instructor since 2001.
Seth Bloombaum is offline   Reply With Quote
Old June 22nd, 2012, 01:00 PM   #4
Trustee
 
Join Date: Jun 2004
Location: Denver, Colorado
Posts: 1,891
Re: h264 tips and tricks

I like Handbrake too but unless I'm missing something, I don't remember a way to add in command line parameters for the ones it doesn't have built into the GUI. So it doesn't appear to implement the full set of x264 commands. In particular, the output does not appear Blu-ray compliant. While it's great for encoding to the web, it doesn't seem to have a way to add the remaining x264 feature set not built into it. If I'm wrong about that, please feel free to correct.

As for command line encoder x264, all of the Handbrake features seem to be inclusive, I think I remember seeing them all there even the Lanczos resizing but I'm not for sure on that one. It's fairly trivial to maintain a text file containing various recipes, that you just copy and paste to the command line. X264.exe is so small, I usually just add a copy of it into the directory folder containing my source file. When rendering, it uses all the cores of my i7 processor.

Here is an example for outputting a Blu-ray compliant stream using fake interlaced mode. This allows the stream to be encoded progressively yet flagged as interlaced.

x264> x264 --bitrate 16000 --preset veryfast --tune film --bluray compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 30 --fps 30000/1001 --force-cfr --open-gop --slices 4 --fake-interlaced --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 -o targetfile.264 source.file

All you would do is paste that to the command line with the correct names for source.file and target file, at the end.

The first command 'x264' invokes the executable. The parameters that follow all begin with '--'. At the end of the parameters, '-o' is the trigger to output a target file from the source file.
Tom Roper is offline   Reply With Quote
Old June 22nd, 2012, 02:22 PM   #5
Major Player
 
Join Date: Feb 2010
Location: London
Posts: 302
Re: h264 tips and tricks

Hi

I wrote the application here http://www.dvinfo.net/forum/what-hap...4-encoder.html

Wraps the x264 encoder to produce compatible Blu-ray/AVCHD output and includes conversions as well.

Regards

Phil
Phil Lee is offline   Reply With Quote
Old June 22nd, 2012, 11:45 PM   #6
Inner Circle
 
Join Date: Sep 2003
Location: Portland, Oregon
Posts: 3,420
Re: h264 tips and tricks

Quote:
Originally Posted by Tom Roper View Post
I like Handbrake too but unless I'm missing something, I don't remember a way to add in command line parameters for the ones it doesn't have built into the GUI. So it doesn't appear to implement the full set of x264 commands. In particular, the output does not appear Blu-ray compliant...
I'm a little out of my depth here, not having done encoding for blu-ray, but my understanding is that in the advanced tab of Handbrake, you can paste in any CL commands you want, with slight adjustments to formatting as in the screengrab below.

I don't have sufficient certainty to recommend HB for a BR workflow, but it may be worth investigating. Does one actually get savings in time and effort to use HB for BR vs. command-line x264? Maybe not; you're still copying and pasting commands. You can use system dialogs for source and destination in HB, that's easier and less headache.

Edit: Oh yeah, HB also offers decent batching via their "queue" system, several filters (which may be in x264, too?), preview, the ability to store presets (no external text file?), muxing of multiple audio tracks, subtitle tracks...
Attached Thumbnails
h264 tips and tricks-hb_customcommands.jpg  
__________________
30 years of pro media production. Vegas user since 1.0. Webcaster since 1997. Freelancer since 2000. College instructor since 2001.

Last edited by Seth Bloombaum; June 23rd, 2012 at 12:07 AM. Reason: added other HB functions
Seth Bloombaum is offline   Reply With Quote
Old June 23rd, 2012, 02:06 AM   #7
Major Player
 
Join Date: Feb 2010
Location: London
Posts: 302
Re: h264 tips and tricks

Hi

This is why I did my own interface to X264 as a lot are more complicated than they need to be in order to produce Blu-ray/AVCHD video. My small app basically calls x264 with the correct command line for Blu-ray/AVCHD, and also checks for the right resolutions, bit-rates and frame rates for the chosen output option.

My work flow from Sony Vegas is:

Output Lagarith uncompressed RGB, essentially the digital negative from the time line.
Ouput the AC3 audio as required.
Into my application which ultimately calls x264 with the correct command lines, this encodes and then mux's in the audio. It also uses AVISynth to resize the resolution if required (i.e. 1080/50p to 720/50p) and more importantly uses AVISynth to do the correct colour conversion for Blu-ray including level changes if required.

Regards

Phil
Phil Lee is offline   Reply With Quote
Old June 23rd, 2012, 07:33 PM   #8
Trustee
 
Join Date: Jun 2004
Location: Denver, Colorado
Posts: 1,891
Re: h264 tips and tricks

Three different workflows ultimately point to the same conclusion, Vegas rendering codecs for h.264 leave a lot to be desired!
Tom Roper is offline   Reply With Quote
Old June 24th, 2012, 10:22 AM   #9
Inner Circle
 
Join Date: Sep 2003
Location: Portland, Oregon
Posts: 3,420
Re: h264 tips and tricks

It's not just Vegas - x264 is much superior to the MP4/h.264 codecs available in Apple workflows using FCP and Compressor as well.

I frequently see horrible artifacts from MP4 encodes out of FCP, it's such a common export method for casual and student work, and it is sooooo bad with picture quality for a given bitrate, including lots of macroblocking artifacts!

By comparison to the QT/h.264 implementations, I'd have to put Vega's Sony and MC h.264 implementations in the middle of the pack for quality. x264 is the quality leader.

Disclaimer: These comparisons are at internet-distribution bitrates.
__________________
30 years of pro media production. Vegas user since 1.0. Webcaster since 1997. Freelancer since 2000. College instructor since 2001.
Seth Bloombaum is offline   Reply With Quote
Old June 25th, 2012, 05:13 AM   #10
Trustee
 
Join Date: Oct 2009
Location: Central Coast Australia
Posts: 1,046
Re: h264 tips and tricks

Question for Phil-
i'm having a go at your app, great work BTW :)
I must admit I have an ulterior motive here,
You see, Handbrake is perfect for me except for one caveat,
I cant drop Cineform or Lagarith into it.
Since I edit anything substantial I do in Cineform, or at least render out to Cineform as a master, Handbrake requires yet another render to MXF to make it work.
So your little app could be a quite brilliant alternative.
Questions-
How would I use your app to resize from 1080p to 720p?
I rendered out an AC3 audio file (twice) but the app drops an error saying it isnt an AC3 file. any ideas?
__________________
http://vimeo.com/livewebvideo
Gerald Webb is offline   Reply With Quote
Old June 25th, 2012, 11:54 AM   #11
Trustee
 
Join Date: Jun 2004
Location: Denver, Colorado
Posts: 1,891
Re: h264 tips and tricks

Quote:
Originally Posted by Seth Bloombaum View Post
It's not just Vegas - x264 is much superior to the MP4/h.264 codecs available in Apple workflows using FCP and Compressor as well.
And now, Sony have just announced the "DoStudio" h.264 encoder for $1k or the DoStudio Blu-ray authoring suite for $7k. Seems to explain why they have been stagnant with DVDA and rendering codecs in general.
Tom Roper is offline   Reply With Quote
Old June 26th, 2012, 01:57 AM   #12
Major Player
 
Join Date: Feb 2010
Location: London
Posts: 302
Re: h264 tips and tricks

Hi

Quote:
Originally Posted by Gerald Webb View Post
Question for Phil-
i'm having a go at your app, great work BTW :)
I must admit I have an ulterior motive here,
You see, Handbrake is perfect for me except for one caveat,
I cant drop Cineform or Lagarith into it.
Since I edit anything substantial I do in Cineform, or at least render out to Cineform as a master, Handbrake requires yet another render to MXF to make it work.
So your little app could be a quite brilliant alternative.
Questions-
How would I use your app to resize from 1080p to 720p?
I rendered out an AC3 audio file (twice) but the app drops an error saying it isnt an AC3 file. any ideas?
When you select the video file it should detect it's frame rate and video size in the Input settings box. To convert 1080p to 720p in the Output side set the resolution to 1280x720p, the frame rate should set itself correctly. You should then indicate if you want Blu-ray or AVCHD, this then sets the maximum bit-rate you can select. What frame rate are you inputting? If you input 25/30p at 1080p I think it should allow you to select 1280x720p and will frame rate double to make the format valid for Blu-ray/AVCHD.

If you can let me know the settings you are rendering for the AC3 file I'll test why it isn't being accepted. If you can't get the video working let me know your Lagarith output settings and I'll replicate here.

Regards

Phil
Phil Lee is offline   Reply With Quote
Old June 26th, 2012, 09:16 PM   #13
Trustee
 
Join Date: Oct 2009
Location: Central Coast Australia
Posts: 1,046
Re: h264 tips and tricks

Hi Phil,
thanks for your reply.
Its actually a Cineform file I was testing with, 1080p at 25fps Progressive.
I'm trying to get a progressive 720p version of it for the web.
This is the ac3 spec-
AC-3 audio (Dolby Digital) with 2.0 stereo, DialNorm -17dB, 256Kbps. DialNorm -17dB is a good starting point for typical broadcast material (speech and popular music).

The ac3 was rendered from the PCM audio in the Cineform file.
Every time I click on the 720p drop down, it just bounces back to 1920x1080.
Penny for your thoughts.
Attached Thumbnails
h264 tips and tricks-problem.jpg  
__________________
http://vimeo.com/livewebvideo
Gerald Webb is offline   Reply With Quote
Old June 27th, 2012, 03:08 AM   #14
Major Player
 
Join Date: Feb 2010
Location: London
Posts: 302
Re: h264 tips and tricks

Hi

Thanks for screen shots, makes it easier to see what is happening.

The input 1920x1080 at 25p to 1280x720p at 25p isn't supported by default as this isn't a valid Blu-ray/AVCHD output, it would need to be frame-rate doubled to 50p. Typically if the input is 1080/25p the best output is 1080/50i as progressive segmented frames, this of course applies to Blu-ray/AVCHD.

What I have done is added a profile for you which will take your 1080/25p input and allow you to output that as 720/25p. To get this download the file from here, and extract the two files (you may need to right click the compressed folder and click 'Unblock') and copy over the sames ones in c:\program files (x86)\Phil Lee\Easy Blu-ray Encoder (or wherever you installed it to), re-start the program and it should now allow you to select 1280x720 at 25fps.

The AC-3 audio file is more tricky. There must be a different tag or identifier from your output that I can't replicate here. Options are to upload a tiny sample of the audio file somewhere so I can see how it is identifying itself, alternatively don't include the audio file, just render out the video, then do a search for "txMuxeR", should be available from Videohelp.com, then drag both the video and AC3 file into that application and Mux them together manually. If I can get a sample file though I will be able to fix the application.

Hope that helps.

Regards

Phil
Phil Lee is offline   Reply With Quote
Old June 27th, 2012, 05:07 AM   #15
Trustee
 
Join Date: Oct 2009
Location: Central Coast Australia
Posts: 1,046
Re: h264 tips and tricks

Hi Phil,
I updated the files which gave me the new presets.
Still having no luck though
see here
http://www.youtube.com/watch?v=CgDr2...ature=youtu.be
also, here is a 15 sec bit of the ac3
Attached Files
File Type: zip ac3 test.zip (466.6 KB, 70 views)
__________________
http://vimeo.com/livewebvideo
Gerald Webb is offline   Reply
Reply

DV Info Net refers all where-to-buy and where-to-rent questions exclusively to these trusted full line dealers and rental houses...

B&H Photo Video
(866) 521-7381
New York, NY USA

Scan Computers Int. Ltd.
+44 0871-472-4747
Bolton, Lancashire UK


DV Info Net also encourages you to support local businesses and buy from an authorized dealer in your neighborhood.
  You are here: DV Info Net > Windows / PC Post Production Solutions > What Happens in Vegas...


 



All times are GMT -6. The time now is 07:16 AM.


DV Info Net -- Real Names, Real People, Real Info!
1998-2024 The Digital Video Information Network