Subsections


Two-pass Encoding with FFmpeg

In CINELERRA-GG for two-pass, you need to run ffmpeg twice, with the same settings, except for designating the options of pass 1 for the first pass and then pass 2. In pass 1, a logfile that ffmpeg needs for the second pass is created. In pass 1 the audio codec should be specified that will be used in pass 2. For more information on ffmpeg 2-pass, check ffmpeg.org. Different libraries may have different requirements and you will probably have to determine this by looking online at ffmpeg or looking directly at that code.

This 2 line ffmpeg 2-pass operation can be functionally duplicated in CINELERRA-GG in the steps below them:

	ffmpeg -y -i $INPUT \
	-c:v libx264 -b:v 2600k -pass 1 \
	-c:a aac -b:a 128k -f mp4 /dev/null && \
	ffmpeg -i $INPUT \
	-c:v libx264 -b:v 2600k -pass 2 \
	-c:a aac -b:a 128k $OUTPUT.mp4

  1. After you have completed your editing, do a Save Session with File Save as...Before starting, be sure your session is ready for batch render. That is, positioned at the beginning and nothing selected.
  2. Bring up File Batch Render...where you will do the setup.
  3. Click on the Delete box to remove old jobs highlighted in the bottom listbox.
  4. Click on New to create the second pass job. You will see this second job in the listbox below. Use the Video wrench and change pass1 to pass2 as follows.
    		flags +pass2
    
  5. Click checkmark OK.
  6. Click on the Start box and watch it go!
  7. You can now check the output file for results. At the time this was documented, rc=2pass will be in the output.

If you need to re-render this, the Batch Render will still be set up but you have to click on the Enabled column in the listbox to re-enable the jobs to run which puts an X there. Click Start again. You can reuse batch job using the save jobs and load jobs buttons in the batch render dialog.

Render shortcuts for webm, h264, h265

are available by using the option files that are already set up for this purpose. Use the render menu as usual, with ffmpeg/mp4, choose h264 or h265 pass1of2_h26x for the video and passes1and2_h26x for the audio; with ffmpeg/webm, choose pass1of2_vp9. When that is finished, you will have to use the render menu again and this time for video, choose pass2of2_h26x or pass2of2_vp9. The logfile is hard coded in the options file so will write over any currently existing logfile if you do not change it before you start the render.

Requirements for some other libraries

(used instead of flags +pass1 & passlogfile):
x265:
add this line:
		x265-params=pass=1:stats=/tmp/{temporary-log-file-name}.log
at the time this document was written, you should see in the output: stats-read=2
libvpx-vp9, xvid, and huffyuv:
 
		cin_stats_filename /tmp/{temporary-log-file-name}.log
		flags +pass1 (or flags +pass2 for the second pass)

NOTE: for vp9, the best Pixels is gbrp

The CINELERRA-GG Community, 2021
https://www.cinelerra-gg.org