Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg: use -fps_mode passthrough instead of deprecated -vsync 0 #147

Merged
merged 1 commit into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ ffmpeg) command lines optimized for high quality and performance are given below
-rc_init_occupancy $((2 * $bitrate)) -low_power ${LOW_POWER:-true} \
-look_ahead_depth 8 -extbrc 1 -b_strategy 1 \
-adaptive_i 1 -adaptive_b 1 -bf 7 -refs 5 -g 256 -strict -1 \
-vsync passthrough -y $output
-fps_mode passthrough -y $output

**HEVC/H.265**::

Expand All @@ -346,15 +346,15 @@ ffmpeg) command lines optimized for high quality and performance are given below
-rc_init_occupancy $((2 * $bitrate)) -low_power ${LOW_POWER:-true} \
-look_ahead_depth 8 -extbrc 1 -b_strategy 1 \
-bf 7 -refs 4 -g 256 -idr_interval begin_only -strict -1 \
-vsync passthrough -y $output
-fps_mode passthrough -y $output

**AV1 (HW-based BRC, EncTools coming soon)**::

ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
-frames:v $numframes -c:v av1_qsv -preset $preset -profile:v main -async_depth 1 \
-b:v $bitrate -maxrate $((2 * $bitrate)) -bufsize $((4 * $bitrate)) \
-rc_init_occupancy $(($bufsize / 2)) -b_strategy 1 -bf 7 -g 256 \
-vsync passthrough -y $output
-fps_mode passthrough -y $output

Extra quality boost can be achieved with use of low power look ahead (by setting
“-look_ahead_depth 40” option) at the expense of a slight performance impact (10-20%).
Expand Down Expand Up @@ -382,22 +382,22 @@ ffmpeg) command lines optimized for high quality and performance are given below
-frames:v $numframes -c:v h264_qsv -preset $preset -profile:v high -async_depth 1 \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((bitrate / 4)) \
-rc_init_occupancy $((bitrate / 8)) -bitrate_limit 0 \
-bf 0 -refs 5 -g 9999 -strict 1 -vsync passthrough -y $output
-bf 0 -refs 5 -g 9999 -strict 1 -fps_mode passthrough -y $output

**HEVC/H.265**::

ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
-frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth 1 \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((bitrate / 4)) \
-rc_init_occupancy $((bitrate / 8)) \
-bf 0 -refs 4 -g 9999 -strict 1 -vsync passthrough -y $output
-bf 0 -refs 4 -g 9999 -strict 1 -fps_mode passthrough -y $output

**AV1**::

ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
-frames:v $numframes -c:v av1_qsv -preset $preset -profile:v main -async_depth 1 \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((bitrate / 2)) -rc_init_occupancy $((bitrate / 4)) \
-bf 0 -g 9999 -vsync passthrough -y $output
-bf 0 -g 9999 -fps_mode passthrough -y $output

Recommendations for more specific use cases as well as additional information on
developer configurable bitrate controllers and available advanced coding options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ ffmpeg -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate \
-c:v h264_qsv -preset medium -profile:v high \
-b:v $bitrate -maxrate $(bitrate*2) -bitrate_limit 0 \
-bufsize $(bitrate*4) -g 256 -extbrc 1 -b_strategy 1 -bf 7 -refs 5 \
-vsync 0 $output
-fps_mode passthrough $output
```

**Example 2: AVC CBR Encode**
Expand All @@ -125,7 +125,7 @@ ffmpeg -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate \
-c:v h264_qsv -preset medium -profile:v high \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bitrate_limit 0 \
-bufsize $(bitrate*2) -g 256 -extbrc 1 -b_strategy 1 -bf 7 -refs 5 \
-vsync 0 $output
-fps_mode passthrough $output
```

**Example 3: HEVC VBR Encode**
Expand All @@ -136,7 +136,7 @@ ffmpeg -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate \
-c:v hevc_qsv -preset medium -profile:v main \
-b:v $bitrate -maxrate $(bitrate*2) -bitrate_limit 0 \
-bufsize $(bitrate*4) -g 256 -extbrc 1 -refs 5 -bf 7 \
-vsync 0 $output
-fps_mode passthrough $output
```

**Example 4: HEVC CBR Encode**
Expand All @@ -147,7 +147,7 @@ ffmpeg -f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate \
-c:v hevc_qsv -preset medium -profile:v main \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bitrate_limit 0 \
-bufsize $(bitrate*2) -g 256 -extbrc 1 -refs 5 -bf 7 \
-vsync 0 $output
-fps_mode passthrough $output
```

## Try it out
Expand Down Expand Up @@ -219,7 +219,7 @@ wget https://repositories.intel.com/media/WAR_TRAILER_HiQ_10_withAudio.mp4
ffmpeg -an -c:v h264_qsv -i WAR_TRAILER_HiQ_10_withAudio.mp4 \
-c:v hevc_qsv -preset medium -profile:v main -b:v 2000000 \
-extbrc 1 -bf 7 -refs 5 \
vsync 0 -y WAR_2Mbps_VBR_QSV.h265
-fps_mode passthrough -y WAR_2Mbps_VBR_QSV.h265
```

## Start Developing
Expand Down
12 changes: 6 additions & 6 deletions doc/performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ To achieve better performance with Intel GPU H.264/AVC encoder running EncTools
-b:v $bitrate -maxrate $((2 * $bitrate)) -bitrate_limit 0 -bufsize $((4 * $bitrate)) \
-rc_init_occupancy $((2 * $bitrate)) -low_power ${LOW_POWER:-true} -look_ahead_depth $lad -extbrc 1 \
-b_strategy 1 -adaptive_i 1 -adaptive_b 1 -bf 7 -refs 5 -g 256 -strict -1 \
-vsync passthrough -y $output
-fps_mode passthrough -y $output

# VBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async $async_depth \
Expand Down Expand Up @@ -284,7 +284,7 @@ Example command lines:
-frames:v $numframes -c:v h264_qsv -preset h264_qsv -profile:v high -async_depth $async_depth \
-b:v $bitrate -maxrate $((2 * $bitrate)) -bitrate_limit 0 -bufsize $((4 * $bitrate)) \
-rc_init_occupancy $((2 * $bitrate)) -low_power ${LOW_POWER:-false} -extbrc 1 -b_strategy 1 -bf 7 -refs 5 -g 256 \
-vsync passthrough -y $output
-fps_mode passthrough -y $output

# VBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async $async_depth -device ${DEVICE:-/dev/dri/renderD128} \
Expand Down Expand Up @@ -345,7 +345,7 @@ Example command lines:
-b:v $bitrate -maxrate $((2 * $bitrate)) -bufsize $((4 * $bitrate)) \
-rc_init_occupancy $((2 * $bitrate)) -low_power ${LOW_POWER:-true} -look_ahead_depth $lad -extbrc 1 -b_strategy 1 \
-bf 7 -refs 4 -g 256 -idr_interval begin_only -strict -1 \
-vsync passthrough -y $output
-fps_mode passthrough -y $output

# VBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async $async_depth -device ${DEVICE:-/dev/dri/renderD128} \
Expand Down Expand Up @@ -395,7 +395,7 @@ Example command lines:
-frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth $async_depth \
-b:v $bitrate -maxrate $((2 * $bitrate)) -bufsize $((4 * $bitrate)) \
-rc_init_occupancy $((2 * $bitrate)) -low_power ${LOW_POWER:-false} -extbrc 1 -bf 7 -refs 4 -g 256 \
-vsync passthrough -y $output
-fps_mode passthrough -y $output

# VBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async $async_depth -device ${DEVICE:-/dev/dri/renderD128} \
Expand Down Expand Up @@ -456,7 +456,7 @@ Example command lines:
-b:v $bitrate -maxrate $((2 * $bitrate)) -bufsize $((4 * $bitrate)) \
-rc_init_occupancy $((2 * $bitrate)) -low_power ${LOW_POWER:-true} -look_ahead_depth $lad -extbrc 1 \
-b_strategy 1 -adaptive_i 1 -adaptive_b 1 -bf 7 -g 256 -strict -1 \
-vsync passthrough -y $output
-fps_mode passthrough -y $output

# VBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::${inputcodec} $input -hw -async $async_depth -device ${DEVICE:-/dev/dri/renderD128} \
Expand Down Expand Up @@ -501,7 +501,7 @@ Example command lines:
-frames:v $numframes -c:v av1_qsv -preset $preset -profile:v main -async_depth $async_depth \
-b:v $bitrate -maxrate $((2 * $bitrate)) -bufsize $((4 * $bitrate)) \
-rc_init_occupancy $(($bufsize / 2)) -b_strategy 1 -bf 7 -g 256 \
-vsync passthrough -y $output
-fps_mode passthrough -y $output

# VBR (transcoding from raw bitstream with Sample Multi-Transcode)
sample_multi_transcode -i::$inputcodec $input -hw -async $async_depth \
Expand Down
16 changes: 8 additions & 8 deletions doc/quality-lowdelay.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ To achieve better quality for low delay use case with Intel GPU H.264/AVC encode
-frames:v $numframes -c:v h264_qsv -preset $preset -profile:v high -async_depth 1 \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((bitrate / 4)) \
-rc_init_occupancy $((bitrate / 8)) -bitrate_limit 0 -low_power ${LOW_POWER:-true} \
-bf 0 -refs 5 -g 9999 -strict 1 -vsync passthrough -y $output
-bf 0 -refs 5 -g 9999 -strict 1 -fps_mode passthrough -y $output

# LD CBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
-frames:v $numframes -c:v h264_qsv -preset $preset -profile:v high -async_depth 1 \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((bitrate / 4)) \
-rc_init_occupancy $((bitrate / 8)) -bitrate_limit 0 -low_power ${LOW_POWER:-true} \
-bf 0 -refs 5 -g 9999 -strict 1 -vsync passthrough -y $output
-bf 0 -refs 5 -g 9999 -strict 1 -fps_mode passthrough -y $output

# LD CBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 \
Expand Down Expand Up @@ -331,14 +331,14 @@ Example command lines:
-frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth 1 \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((bitrate / 4)) \
-rc_init_occupancy $((bitrate / 8)) -low_power ${LOW_POWER:-true} \
-bf 0 -refs 4 -g 9999 -strict 1 -vsync passthrough -y $output
-bf 0 -refs 4 -g 9999 -strict 1 -fps_mode passthrough -y $output

# LD CBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
-frames:v $numframes -c:v hevc_qsv -preset $preset -profile:v main -async_depth 1 \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((bitrate / 4)) \
-rc_init_occupancy $((bitrate / 8)) -low_power ${LOW_POWER:-true} \
-bf 0 -refs 4 -g 9999 -strict 1 -vsync passthrough -y $output
-bf 0 -refs 4 -g 9999 -strict 1 -fps_mode passthrough -y $output

# LD CBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
Expand Down Expand Up @@ -382,13 +382,13 @@ Example command lines:
-f rawvideo -pix_fmt yuv420p -s:v ${width}x${height} -r $framerate -i $inputyuv \
-frames:v $numframes -c:v av1_qsv -preset $preset -profile:v main -async_depth 1 \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((bitrate / 2)) -rc_init_occupancy $((bitrate / 4)) \
-bf 0 -g 9999 -vsync passthrough -y $output
-bf 0 -g 9999 -fps_mode passthrough -y $output

# LD CBR (transcoding with ffmpeg-qsv)
ffmpeg -hwaccel qsv -qsv_device ${DEVICE:-/dev/dri/renderD128} -c:v $inputcodec -an -i $input \
-frames:v $numframes -c:v av1_qsv -preset $preset -profile:v main -async_depth 1 \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((bitrate / 2)) -rc_init_occupancy $((bitrate / 4)) \
-bf 0 -g 9999 -vsync passthrough -y $output
-bf 0 -g 9999 -fps_mode passthrough -y $output

# LD CBR (encoding from YUV with Sample Multi-Transcode)
sample_multi_transcode -i::i420 $inputyuv -hw -async 1 -device ${DEVICE:-/dev/dri/renderD128} \
Expand Down Expand Up @@ -420,7 +420,7 @@ ffmpeg-x264
-i $inputyuv -vframes $numframes -y \
-c:v libx264 -preset medium -profile:v high \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((bitrate / N)) \
-tune zerolatency -threads 12 -vsync passthrough $output
-tune zerolatency -threads 12 -fps_mode passthrough $output

ffmpeg-x265
***********
Expand All @@ -432,7 +432,7 @@ ffmpeg-x265
-i $inputyuv -vframes $numframes -y \
-c:v libx265 -preset medium \
-b:v $bitrate -maxrate $bitrate -minrate $bitrate -bufsize $((bitrate / N)) \
-tune zerolatency -threads 12 -vsync passthrough $output
-tune zerolatency -threads 12 -fps_mode passthrough $output

Links
-----
Expand Down
Loading