Closed Keridos closed 4 years ago
I have the same issue.. Feels like the error also comes up when there are multiple streams - not only multiple audio streams?
Hi, I believe this was fixed in https://github.com/HaveAGitGat/Tdarr_Plugins/commit/17ae08abf321868b72e51222d17a285412310e15#diff-242635b4ab6e14f49c39fec178ffb016
Please re-open if you still have this issue.
@HaveAGitGat I have the same issue for several videos. Looks like it happens for files that include image stream (Film poster). I have changes in the plugin that you mention above.
I can confirm now that issue is because of the image stream. After I added "Tdarr_Plugin_MC93_MigzImageRemoval" plugin before transcoding audio the issue disappear.
Hi, I have similar issue, plugins end with error Invalid encoder type 'ac3' Worker was executed with command
tdarr-ffmpeg -i /temp/movie-TdarrCacheFile-iVEFvoUXr.mkv -c copy -map 0:v -map 0:0 -c:0 ac3 -map 0:s? -map 0:d? -max_muxing_queue_size 9999 /temp/movie-TdarrCacheFile-JN6UqItt_.mkv
and terminate with this error:
2023-08-19T20:43:07.530Z Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 0, only the last option '-c:0 ac3' will be used.
2023-08-19T20:43:07.530Z [vost#0:0 @ 0x56123eaf9d80] Invalid encoder type 'ac3'
2023-08-19T20:43:07.531Z YcRqRK9NS:Node[MainNode]:Worker[fuzzy-fish]:[-error-]
here are my conversions steps:
and here are source movie metadata:
mkv info
+ EBML head
|+ EBML version: 1
|+ EBML read version: 1
|+ Maximum EBML ID length: 4
|+ Maximum EBML size length: 8
|+ Document type: matroska
|+ Document type version: 4
|+ Document type read version: 2
+ Segment: size 4584534402
|+ Seek head (subentries will be skipped)
|+ Tracks
| + Track
| + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
| + Track UID: 10010920397482498474
| + Track type: video
| + "Lacing" flag: 0
| + Language: und
| + Codec ID: V_MPEG4/ISO/AVC
| + Codec's private data: size 51 (H.264 profile: High @L4.0)
| + Default duration: 00:00:00.041708333 (23.976 frames/fields per second for a video track)
| + Language (IETF BCP 47): und
| + Video track
| + Pixel width: 1920
| + Pixel height: 1080
| + Display width: 1920
| + Display height: 1080
| + Video color information
| + Color matrix coefficients: 1
| + Color transfer: 1
| + Color primaries: 1
| + Track
| + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
| + Track UID: 2520554911371279224
| + Track type: audio
| + Language: fre
| + Codec ID: A_EAC3
| + Default duration: 00:00:00.032000000 (31.250 frames/fields per second for a video track)
| + Language (IETF BCP 47): fr-FR
| + Audio track
| + Sampling frequency: 48000
| + Channels: 6
| + Name: French
| + Track
| + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
| + Track UID: 744764234923947488
| + Track type: audio
| + "Default track" flag: 0
| + Codec ID: A_EAC3
| + Default duration: 00:00:00.032000000 (31.250 frames/fields per second for a video track)
| + Language (IETF BCP 47): en
| + Audio track
| + Sampling frequency: 48000
| + Channels: 6
| + Name: English
| + Track
| + Track number: 4 (track ID for mkvmerge & mkvextract: 3)
| + Track UID: 12474795290533675233
| + Track type: subtitles
| + "Default track" flag: 0
| + "Forced display" flag: 1
| + "Lacing" flag: 0
| + Language: fre
| + Codec ID: S_TEXT/UTF8
| + Language (IETF BCP 47): fr-FR
| + Name: French (Forced)
| + Track
| + Track number: 5 (track ID for mkvmerge & mkvextract: 4)
| + Track UID: 6963023701360838119
| + Track type: subtitles
| + "Default track" flag: 0
| + "Lacing" flag: 0
| + Language: fre
| + Codec ID: S_TEXT/UTF8
| + Language (IETF BCP 47): fr-FR
| + Name: French
|+ EBML void: size 3587
|+ Segment information
| + Timestamp scale: 1000000
| + Multiplexing application: libebml v1.4.4 + libmatroska v1.7.1
| + Writing application: mkvmerge v72.0.0 ('Minuano (Six-eight)') 64-bit
| + Duration: 00:52:28.320000000
| + Segment UID: 0x40 0x04 0xcd 0xff 0x4b 0x07 0x41 0xa2 0xd5 0x25 0x9a 0x25 0x25 0x1d 0x9f 0x39
|+ EBML void: size 1693
|+ Cluster
Tdarr and tdarr node are in docker container and updated to latest version
Already tried Migz image removal plugin. Any help ?
Problem happens here too despite the mentioned MigzImageRemovalPlugin.
It happens with files with multiple audio streams as well as a single audio stream. It only occurs very, very rarely as I have just had tdarr check my whole library again, and I'd say it happens to less than 1% of all files.
The issue is still there, I now have 17 files with this error. Does anyone have a solution?
some possibly relevant info:
2023-11-13T09:09:22.630Z YN_UCcXPS:Node[InternalNode]:Worker[some-snipe]:[2/3] tdarr-ffmpeg -i "/mnt/series/Blade Runner - Black Lotus/Season 01/Blade Runner - Black Lotus - S01E04 - The Doll Hunt WEBDL-1080p.mkv" -c copy -map 0:v -map 0:1 -map 0:4 -c:4 aac -map 0:s? -map 0:d? -max_muxing_queue_size 9999 "/temp/Blade Runner - Black Lotus - S01E04 - The Doll Hunt WEBDL-1080p-TdarrCacheFile-jZxUor-0k.mkv"
2023-11-13T09:09:23.634Z Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 4, only the last option '-c:4 aac' will be used.
2023-11-13T09:09:23.634Z [sost#0:4 @ 0x56450f3ade80] Invalid encoder type 'aac'
I had the same issue and noticed that all files where this happened were files where originally only 5.1/71 audio streams were available and Tdarr_Plugin_MC93_Migz5ConvertAudio had added one or more 2.0 audio stream(s) which tadarrs report listed with preexisting subtitle streams in between the original and new audio streams. Moving this plugin to be processed before Tdarr_Plugin_MC93_Migz5ConvertAudio solved the issue for me.
Moving this plugin to be processed before Tdarr_Plugin_MC93_Migz5ConvertAudio solved the issue for me.
Sorry, I am not following. Which plugin did you move before which one? Would you mind sharing a screenshot of your flow perhaps? I would really like to eliminate this problem. For reference see my flow above: https://github.com/HaveAGitGat/Tdarr_Plugins/issues/85#issuecomment-1807691210
I moved this plugin (Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs) to be processed before every other plugin changing, adding or converting streams inside the file because my theory was that the mixed order of streams (video - audio - subtitle - audio) caused by Tdarr_Plugin_MC93_Migz5ConvertAudio creating a new 2.0 audio stream was the cause of the error for me. I also added Tdarr_Plugin_00td_action_re_order_all_streams_v2 in its default configuration afterward in case any new files come with a messed up stream order.
Thanks, I am going to give it a try. May I ask what is going on with your last 2 steps? The one converts the other one transcodes? What are you doing there? (Just being curious)
Migz-Convert audio streams (aTdarr_Plugin_MC93_Migz5ConvertAudio) converts any existing 2.0 audio stream to aac or downsamples an existing 5.1/7.1/whatever stream into an additional 2.0 aac stream if there isn't a 2.0 stream for that language.
Migz-Clean subtitles streams (Tdarr_Plugin_MC93_Migz4CleanSubs) removes subtitles for languages you don't need, reducing the number of entries in the subtitle menu of the player.
I'm no ffmpeg expert, but I think the mapping logic in the plugin is incorrect. I was having trouble with a file structured like:
Stream 0: video 1: audio 2: subtitle 3: audio 4: audio 5-7: some more subtitles
All 3 audio streams should be converted to AAC based on my settings.
The plugin produces the following mappings:
-c copy -map 0:v -map 0:1 -c:1 aac -map 0:3 -c:3 aac -map 0:4 -c:4 aac -map 0:s? -map 0:d? -max_muxing_queue_size 9999
and I receive the invalid encoder type
error for stream 4:
[sost#0:4 @ 0x558bed1c7400] Invalid encoder type 'aac'
I believe the error here is that this has made the following mappings:
-map 0:v maps input stream 0 to output stream 0 -map 0:1 maps input stream 1 to output stream 1 -map 0:3 maps input stream 3 to output stream 2 -map 0:4 maps input stream 4 to output stream 3 -map 0:s? should now map all the subtitles to output streams 4 through whatever
The -c:X settings should refer to output stream numbers, but in the for loop in the plugin it iterates through the input streams. So now -c:3 aac
doesn't cause an error because it is pointing at an audio stream, but it is happens to be the wrong one. -c:4 aac
errors because output stream 4 is a subtitle stream.
Testing my theory, I edited the plugin to simply map all streams, then apply the codec filter on the originals (starting at line 101 in my case):
var ffmpegCommand = `, -c copy -map 0 `; #<--- changed
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
if (
file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" &&
file.ffProbeData.streams[i].codec_name &&
codecs_to_transcode.includes(
file.ffProbeData.streams[i].codec_name.toLowerCase()
)
) {
ffmpegCommand += ` -c:${i} ${encoder} `; #<--- changed
if (inputs.bitrate !== '') {
ffmpegCommand += `-b:a ${inputs.bitrate} `;
}
hasStreamsToTranscode = true;
} else if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
ffmpegCommand += ` -map 0:${i}`; #<---- should be removed?
}
}
This then produces an output file with my expected result, a set of output streams in the same order as the original, with the audio streams converted to AAC (in my case).
So I think the plugin logic will give problems on any file where there are streams that will NOT be converted before streams that will (be those subtitles, data, audio streams that don't need conversion, etc), as the output streams will be re-ordered. It will error out if the re-ordering causes a non-audio stream to be placed in an output stream with the same number as an input stream that was to be converted. But maybe I'm not understanding ffmpeg stream mapping correctly ;) Maybe the intention was to re-order the streams, in which case there should be a separate index used in the for loop to track the output streams.
EDIT: I think the else if
section of the loop also has to be removed, as it would cause duplicate mappings of the audio streams that should not be converted. Also the other 0:s?
and 0:d?
mappings.
@jackmaninov
I'm so glad you posted this because I was running into the exact same issue with my video files and observed the same thing you have in your post. The plugin assumes that the file is ordered as video, audio, subtitles, etc. If a subtitle track exists within the audio track index range, it will attempt to incorrectly map the streams in the output. I don't believe the plugin should re-order the stream indexes like it does currently. Your code suggestion addresses that while also solving the issue.
I've tested this on two files that previously had this issue and are transcoded successfully now.
Another fix (without a code change) would be using Tdarr_Plugin_00td_action_re_order_all_streams_v2
before this plugin and setting the processOrder
to streamTypes,languages,channels,codecs
and streamTypes
to video,audio,subtitle,attachment,data
. I haven't tested this though.
I'd submit an MR, but looking at the MR history I don't know if the dev accepts/reviews MRs.
For others looking at this, this is the full diff:
- var ffmpegCommand = `, -c copy -map 0:v `;
+ var ffmpegCommand = `, -c copy -map 0 `;
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
if (
file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" &&
file.ffProbeData.streams[i].codec_name &&
codecs_to_transcode.includes(
file.ffProbeData.streams[i].codec_name.toLowerCase()
)
) {
- ffmpegCommand += ` -map 0:${i} -c:${i} ${encoder} `;
+ ffmpegCommand += ` -c:${i} ${encoder} `;
if (inputs.bitrate !== '') {
ffmpegCommand += `-b:a ${inputs.bitrate} `;
}
hasStreamsToTranscode = true;
- } else if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
- ffmpegCommand += ` -map 0:${i}`; #<---- should be removed?
}
}
The plugin is set to transform a bunch of audio formats into ac3, including DTS. but it seems to fail when multiple audio streams are present or it mixes up track numbers (not exactly sure).
Command:
Error message:
For reference, this is the files mediainfo: