FFmpeg: Misc improvements, use MD5 muxer and add CUDA/NVDEC decoders#175
FFmpeg: Misc improvements, use MD5 muxer and add CUDA/NVDEC decoders#175mdimopoulos merged 15 commits intofluendo:masterfrom
Conversation
|
I've tested these patches wit ffmpeg/vulkan decoding and it worked ok. |
fluster/decoders/ffmpeg.py
Outdated
|
|
||
| # Get ffmpeg version | ||
| output = _run_ffmpeg_command(self.binary, "-version", verbose=verbose) | ||
| version = re.search(r"ffmpeg version (\d+)\.(\d+)(?:\.(\d+))?", output) |
There was a problem hiding this comment.
nitpick: this re doesn't match when ffmpeg is compiled from git (N-git-describe)
There was a problem hiding this comment.
I have adjusted the pattern to also match builds from release/ branches (n-prefix) and changed the version check to presume that -fps_mode can be used when no version can be determined.
|
Updated to also work with older releases, e.g.
|
Print the verbose output inside run_pipe_command_with_std_output instead of from its callers. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Rename to run_command_with_output and change it to return the full output as a string instead of a list of lines. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Add a run_ffmpeg_command helper and use it to simplify the check for supported decoders and hwaccels. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Current version check does not work on FFmpeg releases using a major.minor version schema, e.g. 7.0 vs 7.0.1. Save ffmpeg_version as a tuple, e.g. (7, 0) or (7, 0, 1), and use this to simplify the check for use of -fps_mode or -vsync. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
The ffmpeg command line is built using three different functions, simplify and create the entire command line inside the decode method. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Normally the name used for -hwaccel and -hwaccel_output_format match. However, that may not always be the case, add hw_output_format to improve support for future hwaccels. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Change output_format_to_ffformat to a property to improve support for future hwaccels that need a different hwdownload format mapping. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Refactor how the ffmpeg command line is built, change to use a list and pass it directly to run_command. Also add hide_banner and change to use the verbose version of parameters, e.g. -codec instead of -c:v. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Add -codec parameter to avoid ffmpeg having to analyze the stream to figure out the codec of the input file. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Use md5 muxer when supported to avoid having to write an output file of rawvideo. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Fluster already can start multiple jobs, restrict ffmpeg to use a single thread per job. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Change to use warning loglevel when non-verbose mode is used. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
FFmpeg VDPAU hwaccel support VP9, add a decoder for it. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
The V4L2 mem2mem decoders contain the codec twice in the name, change to use a more simple name, e.g. FFmpeg-H.264-v4l2m2m instead of FFmpeg-H.264-h264_v4l2m2m. Also add the H.265 decoder. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Add FFmpeg CUDA/NVDEC hwaccel decoders. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
6748616 to
1be6c4b
Compare
|
Thank you all for your awesome contributions, it's been a pleasure! |
|
@mdimopoulos Thanks! I am just guessing that the improved score may have to do with the change to use Prior to the use of With CUDA/NVDEC some tests still cause such issue, and it report that |
|
@Kwiboo Regarding
is it an issue because of FFmpeg itself or are you referring to the definition of FFmpeg decoder within fluster? |
I see this purely as a FFmpeg issue, I think there should not be any need to add an extra surface when a single thread is being used, but have not tried to look into that. My main goal with this PR was to prepare for #179, adding CUDA/NVDEC was more of a bonus and it also helped me run fluster tests directly on my server equipped with a NVIDIA Quadro T400 card. |
|
Great, thanks again! |
This PR include misc improvements and refactorings to simplify building the FFmpeg command line.
utils.run_pipe_command_with_std_output()@lru_cachefor ffmpeg commands used incheck()<master>.<minor>releases-hw_output_formatand-hwaccel_output_formatoutput_format_to_ffformat()tohw_download_mappingpropertydecode()using a string list-codecmd5muxer when supported to avoid always having to save output filesflustersupport running multiple jobsThis was tested using FFmpeg
4.2.1and7.0.1along with GStreamer1.24.5.