fix: universal Intel and AMD VA-API accelerated pipeline for FFmpeg 4 - 7 (#4022)
This commit is contained in:
@@ -191,7 +191,7 @@ func (c *VaapiCodec) GlobalFlags() string {
|
|||||||
|
|
||||||
// PixelFormat is the pixel format required for this codec.
|
// PixelFormat is the pixel format required for this codec.
|
||||||
func (c *VaapiCodec) PixelFormat() string {
|
func (c *VaapiCodec) PixelFormat() string {
|
||||||
return "vaapi_vld"
|
return "vaapi"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scaler is the scaler used for resizing the video in the transcoder.
|
// Scaler is the scaler used for resizing the video in the transcoder.
|
||||||
@@ -201,7 +201,7 @@ func (c *VaapiCodec) Scaler() string {
|
|||||||
|
|
||||||
// ExtraFilters are the extra filters required for this codec in the transcoder.
|
// ExtraFilters are the extra filters required for this codec in the transcoder.
|
||||||
func (c *VaapiCodec) ExtraFilters() string {
|
func (c *VaapiCodec) ExtraFilters() string {
|
||||||
return ""
|
return "hwupload=extra_hw_frames=64,format=vaapi"
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExtraArguments are the extra arguments used with this codec in the transcoder.
|
// ExtraArguments are the extra arguments used with this codec in the transcoder.
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ func TestFFmpegVaapiCommand(t *testing.T) {
|
|||||||
cmd := transcoder.getString()
|
cmd := transcoder.getString()
|
||||||
|
|
||||||
expectedLogPath := filepath.Join("data", "logs", "transcoder.log")
|
expectedLogPath := filepath.Join("data", "logs", "transcoder.log")
|
||||||
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_vaapi -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -map a:0? -c:a:0 copy -preset veryfast -map v:0 -c:v:1 h264_vaapi -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt vaapi_vld -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdofFGg-%d.ts -max_muxing_queue_size 400 -method PUT -http_persistent 1 http://127.0.0.1:8123/%v/stream.m3u8`
|
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_vaapi -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -map a:0? -c:a:0 copy -filter:v:0 "hwupload=extra_hw_frames=64,format=vaapi" -preset veryfast -map v:0 -c:v:1 h264_vaapi -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -filter:v:1 "hwupload=extra_hw_frames=64,format=vaapi" -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt vaapi -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdofFGg-%d.ts -max_muxing_queue_size 400 -method PUT -http_persistent 1 http://127.0.0.1:8123/%v/stream.m3u8`
|
||||||
|
|
||||||
if cmd != expected {
|
if cmd != expected {
|
||||||
t.Errorf("ffmpeg command does not match expected.\nGot %s\n, want: %s", cmd, expected)
|
t.Errorf("ffmpeg command does not match expected.\nGot %s\n, want: %s", cmd, expected)
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ var ignoredErrors = []string{
|
|||||||
"Non-monotonous DTS in output",
|
"Non-monotonous DTS in output",
|
||||||
"frames duplicated",
|
"frames duplicated",
|
||||||
"To ignore this",
|
"To ignore this",
|
||||||
|
"Driver does not support some wanted packed headers (wanted 0xd, found 0x1)",
|
||||||
|
"Failed to allocate a vaapi/nv12 frame from a fixed pool of hardware frames.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleTranscoderMessage(message string) {
|
func handleTranscoderMessage(message string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user