Tutorial: how to encode videos for the new video engine in Cubase 5.5 / Nuendo 5

In this tutorial I will give you a walkthru about how to encode your videos to H264 for the use in Nuendo 5 and Cubase 5.5. Usually, you rarely get the right video format delivered from your client. In most cases you might need to re-encode the video so that it works flawlessly in your DAW. When I still used Nuendo 3, it took me some time to figure out the right video format that I could use without problems. 
I won’t go into much technical detail here, but give you a very short overview so that you can understand what we are doing later on.

You ought to know that all these modern videos formats people use nowadays, take advantage of very sophisticated compression tricks. One of them is the use of P-frames and B-frames (more info here). In contrast to I-frames (also called key-frames), where the picture information is stored independently in each I-frame, P- and B-frames only contain the picture data that has changed since the last I-frame. 
As you can see, with this method it is no longer necessary to save each frame individually. This results in less data and therefore a smaller video file. But since the frames need to be calculated in real time, this procedure also makes it very CPU intensive and almost impossible to scrub through a video file without hiccups (even more if your DAW is fully loaded with virtual instruments). And of course that’s exactly what film composer and sound designer need to do when working with videos.

The alternative formats I used in Nuendo 3/4 were M-JPEG (the movie is saved as a JPEG-sequence) and DV. Both consist of key-frames only. I found that DV never really worked for me, so that I ultimately ended up with M-JPEG in a mov container. Of course this format still works well , but I wasn’t quite satisfied with two aspects:

  1. the video file gets really big (depending on the JPEG quality up to 5GB for 45 minutes of film)
  2. Quicktime always had problems with numerous input formats. This resulted in additional encoding sessions with other tools. Very time consuming if you are in a hurry to score a movie.

So with the release of the new improved video engine in Cubendo, I went on a quest for a better codec and after some testing I found H264 to work very well. H264 also makes use of sophisticated compression methods such as P-frames and B-frames. But the cool thing is, you can completely turn them off and let H264 operate in the I-frame-only-mode, which is exactly what we want. Additionally, many graphics cards support H264 acceleration. Now, since we know which codec we want to use, we need a video encoder that will do the job for us. The best and most versatile video encoder I found to date is Avidemux. It literally almost reads every input video format (check here for a list of supported formats), is open source and cross platform. This makes it the perfect tool for this task and is the only thing we need for this tutorial. Grab it here, unpack/ install and then execute it. The GUI is pretty straightforward and self-explanatory, for our purpose anyway. First click on File -> Open to load the video you want to convert. The video should show in Avidemux. Now have a look at the screenshot below. The three sections take care of the output settings. By default video and audio are set to Copy and format to AVI. This is not what we want for H264.

Avidemux GUI


First, change the format box from AVI to MP4 (not MP4 PSP!). MP4 is the default container format for H264. For the Audio settings it’s a bit a matter of taste. The official audio format for H264 is AAC, but the video engine of Cubendo doesn’t really care what audio format you use. For the sake of not making the sound worse by re-encoding it, you can just leave it (Copy). If you don’t care and just want to have a smaller video file, set Copy to AAC (Faac). Then click on the Configure button and set the bitrate to your desired value. I would go for a setting above 128 kbps.

Avidemux Output Settings


Now let’s go to the most important part, the video settings. Click on Copy, chose MPEG-4 AVC and click on Configure. In the first tab General we chose the Encoding Mode. By default this should be set to Constate Rate Factor (Single Pass). With this setting you can get good and fast results however I advise you to go for a Two Pass encoding like Video Size (Two Pass) or Average Bitrate (Two Pass) because this results in a better overall encoding (quality/size). During the first-pass the encoder analyzes the complexity of the video material and saves this data into a log file. Only in the second-pass the video is actually encoded, based on the log file. If you want to keep the size of the video on a certain level, then you go for Video Size (Two Pass) and enter the desired value in Target Video Size, for example 2000 MB. But if you want to retain an average video quality level, you go for Average Bitrate (Two Pass). In this mode the maximum bitrate will be the value that you enter in the Average Bitrate field, whereas in less complex scenes the codec will chose a lower bitrate.

Avidemux General Tab


That’s it for this tab. Let’s move on to the Frame tab. This is where we tell the encoder not to use P- and B-frames. Apply the settings according the screenshot below:

Avidemux General Tab


You should now save these settings as a template. On the top of the dialog click on Save As and enter
an appropriate name.

That’s all you need to change in the video settings. Click OK to close the dialog. You’re now ready to start encoding. Go to File -> Save -> Save Video and type in a name for the video file.
Avidemux starts immediately with the encoding process. This can take up to several hours, depending on your machine, length of the video and chosen bitrate settings. As reference: I encoded a 45-minute documentation in like 20-30 minutes on Quad with a desired video size of 800MB. Avidemux (the x264 codec) is able to make use of multicore CPUs. This usually results in a very quick encoding on these machines.

When the encoding is done, all you have to do is fire up Cubendo and import the video file. Done! :)



12 Comments

  1. Hello,
    I’m attempting to give your program a try and find that when I open a p-jpeg file with it I get the following error -

    No audio decoder found for this file
    Save (A+V) will generate bad AVI. Save audio will work.

    In addition, if I attempt to export the movie as H264 it goes through the process and then gives me an error that it can’t be completed.

    Here is a copy of the Info from QT -

    16-bit Integer (Little Endian), 5.1 (C L R Ls Rs LFE), 48.000 kHz
    Apple Photo – JPEG, 1920 × 800, Millions

    Any idea why the audio won’t import, and why it crashes the export?

    Thanks
    Hugh

  2. I guess this is one of the rare cases where Avidemux does not have the appropriate codecs to decode the audio.
    Can you upload a short snippet of the video and drop me a mail? I will look into it.

    1. I found another nice program which can be used to achieve the same goal. Apparently it supports more input codecs. Will post the tutorial when I find the time.

  3. [...] VP8 / WebM is here! Sorenson Users Can Encode With It Now …Tutorial: how to encode videos for the new video engine in Cubase … [...]

  4. Hi – been following your tutorial after being directed to it from the Cubase forum. Thanks very much! Couple of points I’d like to share:

    1. Be interested in hearing what the other application you tried is – not terribly keen on Avidemux as I find I have to set up too much every time I use it, and can’t select ‘no audio’ like I can with Virtualdub, however can’t seem to find similar encoding options that give a good, fast and efficient video like I can with your tutorial in Virtualdub.

    2. Setting the quality is a bit of a mystery area. Found I needed to up the bit rate to 10,000kbps to get acceptable quality with the video files I used. Still, resulted in perfectly acceptable file sizes at that bit rate. No idea why it defaults to such a low quality!

  5. Hey Jez!

    Glad you liked the tutorial!

    1. Before Avidemux, I used MPEG Streamclip. But it doesn’t support a lot of input formats. The one I was mentioning in the comments above is called Handbrake. Actually this program is even better. But I first had to figure out how to disable B and P-frames. My intention was to write a second tutorial with Handbrake, but unfortunately time does not permit at the moment. Will do this as soon as I get time.

    2.Yeah, I came across the very same results. Can you share the length of the movie, the bitrate you used and the final size? Would be great!

    Cheers,

    Stephan

    1. MPEG Streamclip will support any codec that is installed on the computer.

      So If you are on a MAC, and have Final Cut installed, ALL the final cut codecs are in MPEG Streamclip.

      Same with Sony Vegas.
      Looks like Avidemux can change some more things, but MPEG is still pretty quick. Wonder if you can disable the B-P frames with MPEG.

      LEX

      1. Hey Lex,

        yup that’s right, however I’m on PC and there MPEG Streamclip is more limited. It doesn’t even recognize the installed DivX codec. Instead you have to install the 3ivx codec. But I agree, MPEG Streamclip is great. It served me for many years.

        But hence, these are all FREE solutions. You don’t have to buy Final Cut or Vegas.
        So this solution is for everyone.

        AFAIK, you can’t disable B-/P-frames in MPEG. That’s what MJPEG is for.

        Best,

        Stevie

  6. I’ve been looking for something like this for weeks now, and it looks like the answer to all my prayers except.. my old G4 can’t handle any release above 2.4.4 where the menu is different. I can’t figure out what’s the ‘Partition & Frames’ setting I need to use in 2.4.4 – can you help?

    1. Hey Emek,

      wow, that’s indeed a problem. I just checked version 2.4.4 and it doesn’t have the important
      parameters as in 2.5.3. A solution to the problem could be to use “Handbrake”: http://handbrake.fr/
      But I’m not sure if there is a PPC version of it. I plan to publish a 2nd part of this tutorial for Handbrake since some people seem to have problems with certain input formats and Avidemux. Handbrake however does not show the B-/P-frame settings in the GUI, you have to set it via command line. I hope to be able to write the tutorial in the next days.

  7. Nice job! Hope you figure out the Handbrake thing soon, because the Avidemux doesn’t work most of the time. I get an error on output every time.
    Thanks!

Leave a Reply