Unmanic / unmanic-plugins

Official plugins for the Unmanic application
21 stars 69 forks source link

Remux AVI (Xvid) to MKV Fails Consistently #144

Open EvilTactician opened 2 years ago

EvilTactician commented 2 years ago

This has failed on all files using the AVI container and Xvid codec. Below is one example of the most recent one, while I remembered to download logs. I've nearly gone through my entire movie library so I won't have much further chance to catch these.

Relevant part of Unmanic logs:

2021-11-15T20:04:28:ERROR:Unmanic.Worker-W0 - [FORMATTED] - Command run against '/library/unraid/Movies/Conviction (2010) - SDTV/Conviction (2010) Bluray-720p.avi' exited with non-zero status. Download command dump from history for more information. - ['ffmpeg', '-hide_banner', '-loglevel', 'info', '-i', '/library/unraid/Movies/Conviction (2010) - SDTV/Conviction (2010) Bluray-720p.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-1636408067.0353053/Conviction (2010) Bluray-720p-1636408067.0352995-WORKING-2.mkv']
2021-11-15T20:04:28:ERROR:Unmanic.Worker-W0 - [FORMATTED] - Error while running worker process 'video_remuxer' on file '/library/unraid/Movies/Conviction (2010) - SDTV/Conviction (2010) Bluray-720p.avi'
2021-11-15T20:04:28:WARNING:Unmanic.Worker-W0 - [FORMATTED] - Failed to convert file '/library/unraid/Movies/Conviction (2010) - SDTV/Conviction (2010) Bluray-720p.avi'
2021-11-15T20:04:28:INFO:Unmanic.Worker-W0 - [FORMATTED] - Finished job - /library/unraid/Movies/Conviction (2010) - SDTV/Conviction (2010) Bluray-720p.avi

Completed task details:

RUNNER:

Strip all image streams from file [Pass #1]

Executing plugin runner... Please wait

Runner did not request to execute a command

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 /library/unraid/Movies/Conviction (2010) - SDTV/Conviction (2010) Bluray-720p.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-1636408067.0353053/Conviction (2010) Bluray-720p-1636408067.0352995-WORKING-2.mkv

LOG:

Input #0, avi, from '/library/unraid/Movies/Conviction (2010) - SDTV/Conviction (2010) Bluray-720p.avi':

   Metadata:

     encoder : VirtualDubMod 1.5.10.2 (build 2540/release)

   Duration: 01:47:02.47, start: 0.000000, bitrate: 3066 kb/s

     Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 1280x688 [SAR 1:1 DAR 80:43], 2606 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc

     Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s

Output #0, matroska, to '/tmp/unmanic/unmanic_file_conversion-1636408067.0353053/Conviction (2010) Bluray-720p-1636408067.0352995-WORKING-2.mkv':

   Metadata:

     encoder : Lavf58.45.100

     Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 1280x688 [SAR 1:1 DAR 80:43], q=2-31, 2606 kb/s, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc

     Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s

Stream mapping:

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

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

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

[matroska @ 0x563ad43e4400] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly

[matroska @ 0x563ad43e4400] Can't write packet with unknown timestamp

av_interleaved_write_frame(): Invalid argument

frame= 1 fps=0.0 q=-1.0 Lsize= 27kB time=00:00:00.44 bitrate= 494.4kbits/s speed=5.46e+03x

video:9kB audio:26kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Conversion failed!
EvilTactician commented 2 years ago
RUNNER:

Strip all image streams from file [Pass #1]

Executing plugin runner... Please wait

Runner did not request to execute a command

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 /library/unraid/Movies/Battle Royale (2000) - Bluray-720p/Battle Royale (2000).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-1636408050.6804347/Battle Royale (2000)-1636408050.6804302-WORKING-2.mkv

LOG:

Input #0, avi, from '/library/unraid/Movies/Battle Royale (2000) - Bluray-720p/Battle Royale (2000).avi':

   Metadata:

     encoder : VirtualDubMod 1.5.10.2 (build 2540/release)

   Duration: 02:01:56.28, start: 0.000000, bitrate: 3330 kb/s

     Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2679 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc

     Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 640 kb/s

Output #0, matroska, to '/tmp/unmanic/unmanic_file_conversion-1636408050.6804347/Battle Royale (2000)-1636408050.6804302-WORKING-2.mkv':

   Metadata:

     encoder : Lavf58.45.100

     Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2679 kb/s, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc

     Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 640 kb/s

Stream mapping:

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

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

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

[matroska @ 0x55a3606febc0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly

[matroska @ 0x55a3606febc0] Can't write packet with unknown timestamp

av_interleaved_write_frame(): Invalid argument

frame= 1 fps=0.0 q=-1.0 Lsize= 38kB time=00:00:00.44 bitrate= 700.1kbits/s speed=4.92e+03x

video:10kB audio:38kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Conversion failed!
joshuar commented 1 year ago

I have a similar problem in my library, also an avi -> mkv remux:

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 [redacted].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-ewktu-1674948196/[redacted]-ewktu-1674948196-WORKING-2-1.mkv

LOG:

Input #0, avi, from '[redacted].avi':

   Metadata:

     software : transcode-1.0.5rc4

   Duration: 00:37:12.90, start: 0.000000, bitrate: 1313 kb/s

   Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 624x352 [SAR 1:1 DAR 39:22], 1164 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.98 tbc

   Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp, 128 kb/s

Output #0, matroska, to '/tmp/unmanic/unmanic_file_conversion-ewktu-1674948196/[redacted]-ewktu-1674948196-WORKING-2-1.mkv':

   Metadata:

     software : transcode-1.0.5rc4

     encoder : Lavf58.76.100

   Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 624x352 [SAR 1:1 DAR 39:22], q=2-31, 1164 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 29.97 tbc

   Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp, 128 kb/s

Stream mapping:

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

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

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

[matroska @ 0x55a7924b2000] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly

frame= 1 fps=0.0 q=-1.0 size= 1kB time=00:00:00.00 bitrate=5960.0kbits/s speed=N/A

[matroska @ 0x55a7924b2000] Can't write packet with unknown timestamp

av_interleaved_write_frame(): Invalid argument

frame= 1 fps=0.0 q=-1.0 Lsize= 1kB time=00:00:00.00 bitrate=9208.0kbits/s speed=14.3x

video:2kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Conversion failed!

A suggestion seems to be to add -fflags +genpts to the command-line to generate the missing information. Not an expert, looking for others more knowledgeable for a fix.

Although it appears, you cannot customise the ffmpeg options for the remuxing plugin to try it out?

joshuar commented 1 year ago

Can confirm, copying the ffmpeg command-line in the output above and manually inserting -fflags +genpts before the -i option ensures the remux is successful.

Also potentially related: https://trac.ffmpeg.org/ticket/1552. That's a decade-old issue but seems relevant? There is a similar age feature request to auto-detect when -fflags +genpts is necessary but sounds potentially like it is difficult to do.

Unsure if this would have any negative effects for any other type of remux action if just added by default?