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
|
- 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.
- Bring up File
→ Batch Render...where
you will do the setup.
- Click on the Delete box to remove old jobs
highlighted in the bottom listbox.
- For the File Format choose ffmpeg and mp4 for the
type.
- Set Output path to the path and filename for the
render output file.
- Click on Use Current EDL to use the designated EDL
Path file.
- Click on New and you will see a new highlighted job
show up in the listbox at the bottom.
- Use the Audio wrench to set bitrate to 128000 (128k as
in ffmpeg example above).
- Click checkmark OK. Open the video tools with the video
wrench.
- Set the Video Compression to h264.mp4 (as seen in
the example).
- Set the bitrate to 2600000 (2600k as in ffmpeg example
above).
- Add the following 2 lines after the first line:
flags +pass1
passlogfile /tmp/"{temporary log file name}.log"
|
Click checkmark OK.
- 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.
- Click checkmark OK.
- Click on the Start box and watch it go!
- 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.
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.
(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