Unmanic / unmanic

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

Mjpeg streams are ignored by encoding plugins #414

Open Funsponge opened 11 months ago

Funsponge commented 11 months ago

When attempting to process files with mjpeg streams, encoding plugins will bypass workflow with the following:

Executing plugin runner... Please wait
Runner did not request for Unmanic to execute a command

I have configured a plugin stack with the following, remuxing before the video encode upon advice from Discord users:

Audio Encoder AAC Remux Video Files (mp4) Video Encoder H265/HEVC - hevc_nvenc (NVIDIA GPU)

I have also tried the CPU based lib265 encoder with the same results.

File format as follows:

Format                    : AVI
Format/Info               : Audio Video Interleave
File size                 : 51.4 MiB
Duration                  : 8 s 0 ms
Overall bit rate          : 53.9 Mb/s

Video
ID                        : 0
Format                    : JPEG
Codec ID                  : MJPG
Duration                  : 8 s 0 ms
Bit rate                  : 53.5 Mb/s
Width                     : 1 920 pixels
Height                    : 1 080 pixels
Display aspect ratio      : 16:9
Frame rate                : 30.000 FPS
Color space               : YUV
Chroma subsampling        : 4:2:2
Bit depth                 : 8 bits
Scan type                 : Progressive
Compression mode          : Lossy
Bits/(Pixel*Frame)        : 0.861
Stream size               : 51.1 MiB (99%)

Audio
ID                        : 1
Format                    : PCM
Format settings           : Little
Codec ID                  : 1
Duration                  : 8 s 0 ms
Bit rate mode             : Constant
Bit rate                  : 256 kb/s
Channel(s)                : 1 channel
Sampling rate             : 16.0 kHz
Bit depth                 : 16 bits
Stream size               : 250 KiB (0%)

Unmanic Version: 0.2.4~7339f8b in a docker container.

Full log output for one of the attempts:

RUNNER:

Audio Encoder AAC [Pass #1]

Executing plugin runner... Please wait

Plugin runner requested for a command to be executed by Unmanic

COMMAND:

ffmpeg -hide_banner -loglevel info -i /library/creaturecam/2020-07-26/DSCF0002.AVI -strict -2 -max_muxing_queue_size 4096 -map 0:v:0 -map 0:a:0 -c:v:0 copy -c:a:0 aac -b:a:0 64k -y /tmp/unmanic/unmanic_file_conversion-blnhe-1687216986/DSCF0002-blnhe-1687216986-WORKING-1-1.AVI

LOG:

Guessed Channel Layout for Input Stream #0.1 : mono

Input #0, avi, from '/library/creaturecam/2020-07-26/DSCF0002.AVI':

   Duration: 00:00:29.00, start: 0.000000, bitrate: 55018 kb/s

   Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 54808 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc

   Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s

Stream mapping:

   Stream #0:0 -> #0:0 (copy)

   Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))

Press [q] to stop, [?] for help

Output #0, avi, to '/tmp/unmanic/unmanic_file_conversion-blnhe-1687216986/DSCF0002-blnhe-1687216986-WORKING-1-1.AVI':

   Metadata:

     ISFT : Lavf58.76.100

   Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, q=2-31, 54808 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc

   Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 16000 Hz, mono, fltp, 64 kb/s

     Metadata:

       encoder : Lavc58.134.100 aac

frame= 0 fps=0.0 q=-1.0 size= 10kB time=00:00:00.00 bitrate=N/A speed=N/A

frame= 870 fps=0.0 q=-1.0 Lsize= 194066kB time=00:00:29.00 bitrate=54820.3kbits/s speed=90.4x

video:193801kB audio:224kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.021229%

[aac @ 0x55e7573b9b40] Qavg: 44584.836

RUNNER:

Remux Video Files [Pass #1]

Executing plugin runner... Please wait

Plugin runner requested for a command to be executed by Unmanic

COMMAND:

ffmpeg -hide_banner -loglevel info -i /tmp/unmanic/unmanic_file_conversion-blnhe-1687216986/DSCF0002-blnhe-1687216986-WORKING-1-1.AVI -strict -2 -max_muxing_queue_size 4096 -map 0:v:0 -map 0:a:0 -c:v:0 copy -c:a:0 copy -y /tmp/unmanic/unmanic_file_conversion-blnhe-1687216986/DSCF0002-blnhe-1687216986-WORKING-2-1.mp4

LOG:

Input #0, avi, from '/tmp/unmanic/unmanic_file_conversion-blnhe-1687216986/DSCF0002-blnhe-1687216986-WORKING-1-1.AVI':

   Metadata:

     software : Lavf58.76.100

   Duration: 00:00:29.12, start: 0.000000, bitrate: 54594 kb/s

   Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 54682 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc

   Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 16000 Hz, mono, fltp, 64 kb/s

Output #0, mp4, to '/tmp/unmanic/unmanic_file_conversion-blnhe-1687216986/DSCF0002-blnhe-1687216986-WORKING-2-1.mp4':

   Metadata:

     software : Lavf58.76.100

     encoder : Lavf58.76.100

   Stream #0:0: Video: mjpeg (Baseline) (mp4v / 0x7634706D), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, q=2-31, 54682 kb/s, 30 fps, 30 tbr, 15360 tbn, 30 tbc

   Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 64 kb/s

Stream mapping:

   Stream #0:0 -> #0:0 (copy)

   Stream #0:1 -> #0:1 (copy)

Press [q] to stop, [?] for help

frame= 0 fps=0.0 q=-1.0 size= 0kB time=00:00:00.00 bitrate=N/A speed=N/A

frame= 870 fps=0.0 q=-1.0 Lsize= 194036kB time=00:00:29.05 bitrate=54706.1kbits/s speed= 179x

video:193801kB audio:224kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.005721%

RUNNER:

Video Encoder H265/HEVC - hevc_nvenc (NVIDIA GPU) [Pass #1]

Executing plugin runner... Please wait

Runner did not request for Unmanic to execute a command

Additionally, I have manually converted one of these files with ffmpeg without issue, perhaps there is some way to bypass whatever checks are in place and force the plugin to process the files?