cisco / openh264

Open Source H.264 Codec
BSD 2-Clause "Simplified" License
5.57k stars 1.8k forks source link

slice_mode option does not exist; blurry content #3683

Open ProdigyView opened 1 year ago

ProdigyView commented 1 year ago

I am trying get live streaming using libopenh264 near the quality of libx264, but I am running into the quality issues. Here is a live stream standing still:

no_blurry

And here is image when there is fast movement:

blurry

The only documentation I've been able to find on options for libopenh264 is here: https://support.medialooks.com/hc/en-us/articles/360000210192-H-264-encoding-options

Which give these values:

Name Default value Description
slices 0 Set the number of slices, used in the parallelized encoding. This is only used when slice_mode is set to ‘fixed’
slice_mode auto Set slice mode.Possible values:fixedrowmbautodyn
loopfilter 1 Enable loop filter, if set to 1. To disable set a value of 0.
max_nal_size 0 Set maximum NAL size in bytes.
allow_skip_frames 0 Allow skipping frames to hit the target bitrate if set to 1.

But it seems options like slice_mode is incorrect, and playing around with options like slices and max_nal_size don't do anything. Here is my ffmpeg command:

ffmpeg -y  -i pipe:0 -vf "scale=1920:1080:out_color_matrix=bt709" -color_primaries bt709 -color_trc bt709 -colorspace bt709 -c:v libopenh264 -b:v 9000k  -profile:v high -slices 10 -allow_skip_frames 1 -b_strategy 0 -maxrate 12000k -bufsize 9000k -pix_fmt yuv420p -r 60 -g 120 -c:a aac -b:a 256k -ac 2 -ar 44100  -af afftdn -f tee -map 0 "[f=flv]${data.stream.invirtu_rtmp_broadcast_endpoint}?sign=${data.stream.invirtu_rtmp_broadcast_key}|[f=mp4]${escapedTempFilePath}"`;

Are there any other options I can be testing for libopenh264 to improve the quality?

joakim-tjernlund commented 1 year ago

Maybe related to https://github.com/cisco/openh264/pull/3638 ? Try git version if so