Unmanic / unmanic

Unmanic - Library Optimiser
GNU General Public License v3.0
1.66k stars 82 forks source link

Plugin hevc_qsv injects Main Options in the wrong place #491

Open jecorn opened 4 months ago

jecorn commented 4 months ago

Describe the Bug

I noticed that the hevc_vaapi plugin (0.0.5) includes the -hwaccel vaapi option. But the hevc_qsv plugin omits -hwaccel qsv and has no checkbox to enable it. I tried to add -hwaccel qsv to the 'Custom Main Options" section of the own ffmpeg params. The docs state that these should be injected before the input

ffmpeg \
    -hide_banner \
    -loglevel info \
    <CUSTOM MAIN OPTIONS HERE> \
    -i /library/TEST_FILE.mkv \
    <CUSTOM ADVANCED OPTIONS HERE> \
    -map 0:v:0 \
    -map 0:a:0 \
    -map 0:a:1 \
    -c:v:0 hevc_qsv \
    <CUSTOM VIDEO OPTIONS HERE> \
    -c:a:0 copy \
    -c:a:1 copy \
    -y /path/to/output/video.mkv 

However, I found that it was instead injected after the input, rendering the ffmpeg command line invalid: ffmpeg -hide_banner -loglevel info -init_hw_device qsv=hw -filter_hw_device hw -i /library/TV Shows/MyVideo.mkv -hwaccel qsv -strict -2 -max_muxing_queue_size 2048 -map 0:v:0 -map 0:a:0 -map 0:a:1 -map 0:s:0 -map 0:s:1 -map 0:t:0 -map 0:t:1 -map 0:t:2 -c:v:0 hevc_qsv -preset slow -tune film -global_quality 23 -look_ahead 1 -c:a:0 copy -c:a:1 copy -c:s:0 copy -c:s:1 copy -c:t:0 copy -c:t:1 copy -c:t:2 copy -y /tmp/unmanic/unmanic_file_conversion-sqxde-1718615082/MyVideo.mkv

Steps to Reproduce

  1. Load the hevc_qsv plugin
  2. Add an option to the "custom main options"
  3. start encoding

Expected Behavior

Option is added before input, but they instead go after the input

Screenshots

image

Relevant Settings

No response

Version

0.2.7~d14f498

Platform

Ubuntu 20.04, Docker

Relevant log output

Option hwaccel (use HW accelerated decoding) cannot be applied to output url /tmp/unmanic/unmanic_file_conversion-crsun-1718615080/MyMovie.mkv -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.

Error parsing options for output file /tmp/unmanic/unmanic_file_conversion-crsun-1718615080/MyMovie.mkv.