HaveAGitGat / Tdarr_Plugins

Tdarr Plugins
GNU General Public License v3.0
135 stars 151 forks source link

Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs transcoding fail when multiple audio streams are present #85

Closed Keridos closed 4 years ago

Keridos commented 4 years ago

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:

/home/Tdarr/Tdarr/bundle/programs/server/assets/app/ffmpeg/ffmpeg42/ffmpeg -i '/home/Tdarr/media/movie.mkv' -c copy -map 0:v -map 0:2 -c:2 ac3 -map 0:s? -map 0:d? '/home/Tdarr/cache/movie-TdarrCacheFile-1IbvQMDs-.mkv' 

Error message:

Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 2, only the last option '-c:2 ac3' will be used.
Invalid encoder type 'ac3'

For reference, this is the files mediainfo:

General
Unique ID                                : blabla
Complete name                            : movie.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 11.3 GiB
Duration                                 : 2 h 15 min
Overall bit rate                         : 12.0 Mb/s
Encoded date                             : UTC 2018-09-13 23:45:38
Writing application                      : mkvmerge v8.3.0 ('Over the Horizon') 64bit
Writing library                          : libebml v1.3.1 + libmatroska v1.4.2

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings                          : CABAC / 5 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 5 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 2 h 14 min
Bit rate                                 : 10.1 Mb/s
Width                                    : 1 920 pixels
Height                                   : 808 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.272
Stream size                              : 9.51 GiB (84%)
Writing library                          : x264 core 157 r2932 303c484
Encoding settings                        : cabac=1 / ref=5 / deblock=1:-3:-3 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=24 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=2pass / mbtree=1 / bitrate=10102 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Default                                  : Yes
Forced                                   : No

Audio #1
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : A_AC3
Duration                                 : 2 h 15 min
Bit rate mode                            : Constant
Bit rate                                 : 384 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Delay relative to video                  : 833 ms
Stream size                              : 371 MiB (3%)
Language                                 : German
Service kind                             : Complete Main
Default                                  : Yes
Forced                                   : Yes

Audio #2
ID                                       : 3
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Codec ID                                 : A_DTS
Duration                                 : 2 h 14 min
Bit rate mode                            : Constant
Bit rate                                 : 1 509 kb/s
Channel(s)                               : 6 channels
Channel layout                           : C L R Ls Rs LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 SPF)
Bit depth                                : 24 bits
Compression mode                         : Lossy
Stream size                              : 1.42 GiB (13%)
Language                                 : English
Default                                  : No
Forced                                   : No

Text #1
ID                                       : 4
Format                                   : UTF-8
Codec ID                                 : S_TEXT/UTF8
Codec ID/Info                            : UTF-8 Plain Text
Duration                                 : 1 h 20 min
Bit rate                                 : 1 b/s
Count of elements                        : 20
Stream size                              : 910 Bytes (0%)
Title                                    : ger forced
Language                                 : German
Default                                  : Yes
Forced                                   : Yes

Text #2
ID                                       : 5
Format                                   : UTF-8
Codec ID                                 : S_TEXT/UTF8
Codec ID/Info                            : UTF-8 Plain Text
Duration                                 : 2 h 6 min
Bit rate                                 : 53 b/s
Count of elements                        : 1720
Stream size                              : 49.6 KiB (0%)
Title                                    : ger regular
Language                                 : German
Default                                  : No
Forced                                   : No

Text #3
ID                                       : 6
Format                                   : UTF-8
Codec ID                                 : S_TEXT/UTF8
Codec ID/Info                            : UTF-8 Plain Text
Duration                                 : 1 h 17 min
Bit rate                                 : 0 b/s
Count of elements                        : 16
Stream size                              : 362 Bytes (0%)
Title                                    : eng forced
Language                                 : English
Default                                  : No
Forced                                   : No
jepz88 commented 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?

HaveAGitGat commented 4 years ago

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.

shir commented 3 years ago

@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.

Here is an example: ``` Command: ffmpeg -i '/media/movies/The Second Best Exotic Marigold Hotel (2015)/The Second Best Exotic Marigold Hotel (2015) - Bluray-1080p.DTS.x264.mkv' -c copy -map 0:v -map 0:1 -c:1 eac3 -map 0:2 -c:2 eac3 -map 0:s? -map 0:d? -max_muxing_queue_size 9999 '/media/cache/The Second Best Exotic Marigold Hotel (2015) - Bluray-1080p.DTS.x264-TdarrCacheFile-B61VLZ4IB.mkv' Last 200 lines of CLI log: shellThread ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-10ubuntu2) configuration: --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --disable-debug --disable-doc --disable-ffplay --disable-static --enable-cuda-nvcc --enable-cuda-sdk --enable-cuvid --enable-ffprobe --enable-gpl --enable-libaom --enable-libass --enable-libfdk_aac --enable-libfreetype --enable-libkvazaar --enable-libmp3lame --enable-libnpp --enable-libopencore-amrnb --enable-libopenjpeg --enable-libopus --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-nonfree --enable-nvdec --enable-nvenc --enable-openssl --enable-shared --enable-small --enable-stripping --enable-vaapi --enable-vdpau --enable-version3 libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 Input #0, matroska,webm, from '/media/movies/The Second Best Exotic Marigold Hotel (2015)/The Second Best Exotic Marigold Hotel (2015) - Bluray-1080p.DTS.x264.mkv': Metadata: title : Отель «Мэриголд». Заселение продолжается / The Second Best Exotic Marigold Hotel (2015) BDRip 1080p by Elheym [HQCLUB] encoder : libebml v1.2.3 + libmatroska v1.3.0 creation_time : 2015-07-23T09:24:46.000000Z Duration: 02:02:40.41, start: 0.000000, bitrate: 16721 kb/s Chapter #0:0: start 0.000000, end 254.337400 Metadata: title : Chapter 01 Chapter #0:1: start 254.337400, end 575.866956 Metadata: title : Chapter 03 Chapter #0:2: start 575.866956, end 914.955689 Metadata: title : Chapter 05 Chapter #0:3: start 914.955689, end 1160.659489 Metadata: title : Chapter 07 Chapter #0:4: start 1160.659489, end 1381.797067 Metadata: title : Chapter 09 Chapter #0:5: start 1381.797067, end 1700.031667 Metadata: title : Chapter 11 Chapter #0:6: start 1700.031667, end 1948.696733 Metadata: title : Chapter 13 Chapter #0:7: start 1948.696733, end 2160.783622 Metadata: title : Chapter 15 Chapter #0:8: start 2160.783622, end 2395.101022 Metadata: title : Chapter 17 Chapter #0:9: start 2395.101022, end 2679.093067 Metadata: title : Chapter 19 Chapter #0:10: start 2679.093067, end 2993.407067 Metadata: title : Chapter 21 Chapter #0:11: start 2993.407067, end 3235.732489 Metadata: title : Chapter 23 Chapter #0:12: start 3235.732489, end 3513.635111 Metadata: title : Chapter 25 Chapter #0:13: start 3513.635111, end 3775.271489 Metadata: title : Chapter 27 Chapter #0:14: start 3775.271489, end 3919.206956 Metadata: title : Chapter 29 Chapter #0:15: start 3919.206956, end 4242.488244 Metadata: title : Chapter 31 Chapter #0:16: start 4242.488244, end 4469.882067 Metadata: title : Chapter 33 Chapter #0:17: start 4469.882067, end 4668.372022 Metadata: title : Chapter 35 Chapter #0:18: start 4668.372022, end 4885.171955 Metadata: title : Chapter 37 Chapter #0:19: start 4885.171955, end 5215.627067 Metadata: title : Chapter 39 Chapter #0:20: start 5215.627067, end 5452.196733 Metadata: title : Chapter 41 Chapter #0:21: start 5452.196733, end 5717.670289 Metadata: title : Chapter 43 Chapter #0:22: start 5717.670289, end 5914.742156 Metadata: title : Chapter 45 Chapter #0:23: start 5914.742156, end 6273.976022 Metadata: title : Chapter 47 Chapter #0:24: start 6273.976022, end 6460.120333 Metadata: title : Chapter 49 Chapter #0:25: start 6460.120333, end 6722.924533 Metadata: title : Chapter 51 Chapter #0:26: start 6722.924533, end 6987.981000 Metadata: title : Chapter 53 Chapter #0:27: start 6987.981000, end 7360.144444 Metadata: title : Chapter 55 Chapter #0:28: start 7360.144444, end 7360.406000 Metadata: title : Chapter 56 Stream #0:0(eng): Video: h264, yuv420p(progressive), 1920x804 [SAR 1:1 DAR 160:67], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) Metadata: title : Отель «Мэриголд». Заселение продолжается / The Second Best Exotic Marigold Hotel (2015) BDRip 1080p by Elheym [HQCLUB] Stream #0:1(rus): Audio: dts, 48000 Hz, 5.1(side), fltp, 768 kb/s Metadata: title : DTS 5.1 @ 768 kbps - Dub, BD EUR Stream #0:2(eng): Audio: dts, 48000 Hz, 5.1(side), fltp, 1536 kb/s Metadata: title : DTS 5.1 @ 1509 kbps - Original Stream #0:3(rus): Subtitle: subrip Metadata: title : Full, BD Stream #0:4(rus): Subtitle: subrip Metadata: title : Full, iTunes Stream #0:5(rus): Subtitle: subrip (default) Metadata: title : Forced, iTunes Stream #0:6(ukr): Subtitle: subrip Metadata: title : Full, BD Stream #0:7(ukr): Subtitle: subrip Metadata: title : Full, iTunes Stream #0:8(eng): Subtitle: subrip Metadata: title : Full, BD Stream #0:9(eng): Subtitle: subrip Metadata: title : Full, iTunes Stream #0:10(eng): Subtitle: subrip Metadata: title : Forced, iTunes Stream #0:11(eng): Subtitle: subrip Metadata: title : SDH Stream #0:12(eng): Subtitle: subrip Metadata: title : SDH Colored Stream #0:13: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 500x643 [SAR 1:1 DAR 500:643], 90k tbr, 90k tbn, 90k tbc (attached pic) Metadata: filename : Cover.jpg mimetype : image/jpeg Invalid encoder type 'eac3' ```
Here is another example: ``` Command: ffmpeg -i '/media/movies/X2 (2003)/X2 (2003) - Bluray-2160p.DTS.x265.mkv' -c copy -map 0:v -map 0:1 -c:1 ac3 -map 0:2 -map 0:3 -map 0:4 -map 0:5 -map 0:6 -map 0:7 -map 0:8 -c:8 ac3 -map 0:9 -map 0:s? -map 0:d? -max_muxing_queue_size 9999 '/media/cache/X2 (2003) - Bluray-2160p.DTS.x265-TdarrCacheFile-U9VlHj6Xj.mkv' Last 200 lines of CLI log: shellThread ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-10ubuntu2) configuration: --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --nvccflags='-gencode arch=compute_52,code=sm_52 -O2' --disable-debug --disable-doc --disable-ffplay --disable-static --enable-cuda-nvcc --enable-cuda-sdk --enable-cuvid --enable-ffprobe --enable-gpl --enable-libaom --enable-libass --enable-libfdk_aac --enable-libfreetype --enable-libkvazaar --enable-libmp3lame --enable-libnpp --enable-libopencore-amrnb --enable-libopenjpeg --enable-libopus --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-nonfree --enable-nvdec --enable-nvenc --enable-openssl --enable-shared --enable-small --enable-stripping --enable-vaapi --enable-vdpau --enable-version3 libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 Input #0, matroska,webm, from '/media/movies/X2 (2003)/X2 (2003) - Bluray-2160p.DTS.x265.mkv': Metadata: title : X2.2003.2160p.BluRay.10bit.HEVC.HDR.4K.x265.Master5 encoder : libebml v1.3.1 + libmatroska v1.4.2 creation_time : 2018-09-22T21:50:22.000000Z Duration: 02:13:47.52, start: 0.000000, bitrate: 31869 kb/s Chapter #0:0: start 0.000000, end 110.527000 Metadata: title : 00:00:00.000 Chapter #0:1: start 110.527000, end 321.947000 Metadata: title : 00:01:50.527 Chapter #0:2: start 321.947000, end 432.265000 Metadata: title : 00:05:21.947 Chapter #0:3: start 432.265000, end 747.121000 Metadata: title : 00:07:12.265 Chapter #0:4: start 747.121000, end 934.225000 Metadata: title : 00:12:27.121 Chapter #0:5: start 934.225000, end 1077.326000 Metadata: title : 00:15:34.225 Chapter #0:6: start 1077.326000, end 1165.706000 Metadata: title : 00:17:57.326 Chapter #0:7: start 1165.706000, end 1367.616000 Metadata: title : 00:19:25.706 Chapter #0:8: start 1367.616000, end 1569.693000 Metadata: title : 00:22:47.616 Chapter #0:9: start 1569.693000, end 1755.963000 Metadata: title : 00:26:09.693 Chapter #0:10: start 1755.963000, end 1870.285000 Metadata: title : 00:29:15.963 Chapter #0:11: start 1870.285000, end 2021.686000 Metadata: title : 00:31:10.285 Chapter #0:12: start 2021.686000, end 2109.524000 Metadata: title : 00:33:41.686 Chapter #0:13: start 2109.524000, end 2390.179000 Metadata: title : 00:35:09.524 Chapter #0:14: start 2390.179000, end 2735.733000 Metadata: title : 00:39:50.179 Chapter #0:15: start 2735.733000, end 2838.335000 Metadata: title : 00:45:35.733 Chapter #0:16: start 2838.335000, end 3024.104000 Metadata: title : 00:47:18.335 Chapter #0:17: start 3024.104000, end 3197.986000 Metadata: title : 00:50:24.104 Chapter #0:18: start 3197.986000, end 3340.420000 Metadata: title : 00:53:17.986 Chapter #0:19: start 3340.420000, end 3434.931000 Metadata: title : 00:55:40.420 Chapter #0:20: start 3434.931000, end 3561.808000 Metadata: title : 00:57:14.931 Chapter #0:21: start 3561.808000, end 3895.892000 Metadata: title : 00:59:21.808 Chapter #0:22: start 3895.892000, end 4163.701000 Metadata: title : 01:04:55.892 Chapter #0:23: start 4163.701000, end 4488.734000 Metadata: title : 01:09:23.701 Chapter #0:24: start 4488.734000, end 4698.485000 Metadata: title : 01:14:48.734 Chapter #0:25: start 4698.485000, end 5092.546000 Metadata: title : 01:18:18.485 Chapter #0:26: start 5092.546000, end 5236.440000 Metadata: title : 01:24:52.546 Chapter #0:27: start 5236.440000, end 5432.385000 Metadata: title : 01:27:16.440 Chapter #0:28: start 5432.385000, end 5553.923000 Metadata: title : 01:30:32.385 Chapter #0:29: start 5553.923000, end 5804.090000 Metadata: title : 01:32:33.923 Chapter #0:30: start 5804.090000, end 6076.070000 Metadata: title : 01:36:44.090 Chapter #0:31: start 6076.070000, end 6211.163000 Metadata: title : 01:41:16.070 Chapter #0:32: start 6211.163000, end 6398.058000 Metadata: title : 01:43:31.163 Chapter #0:33: start 6398.058000, end 6518.637000 Metadata: title : 01:46:38.058 Chapter #0:34: start 6518.637000, end 6821.940000 Metadata: title : 01:48:38.637 Chapter #0:35: start 6821.940000, end 7098.883000 Metadata: title : 01:53:41.940 Chapter #0:36: start 7098.883000, end 7334.661000 Metadata: title : 01:58:18.883 Chapter #0:37: start 7334.661000, end 7478.471000 Metadata: title : 02:02:14.661 Chapter #0:38: start 7478.471000, end 7511.170000 Metadata: title : 02:04:38.471 Chapter #0:39: start 7511.170000, end 8027.520000 Metadata: title : 02:05:11.170 Stream #0:0: Video: hevc, yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x1600 [SAR 1:1 DAR 12:5], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default) Metadata: title : X2.2003.2160p.BluRay.10bit.HEVC.HDR.4K.x265.Master5 BPS : 22731107 BPS-eng : 22731107 DURATION : 02:13:47.478000000 DURATION-eng : 02:13:47.478000000 NUMBER_OF_FRAMES: 192467 NUMBER_OF_FRAMES-eng: 192467 NUMBER_OF_BYTES : 22809183486 NUMBER_OF_BYTES-eng: 22809183486 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:1(rus): Audio: dts, 48000 Hz, 5.1(side), fltp, 768 kb/s (default) Metadata: title : дублированный BPS : 768000 BPS-eng : 768000 DURATION : 02:13:47.488000000 DURATION-eng : 02:13:47.488000000 NUMBER_OF_FRAMES: 752577 NUMBER_OF_FRAMES-eng: 752577 NUMBER_OF_BYTES : 770638848 NUMBER_OF_BYTES-eng: 770638848 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:2 (rus): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s Metadata: title : Многоголосый закадровый BPS : 640000 BPS-eng : 640000 DURATION : 02:13:47.520000000 DURATION-eng : 02:13:47.520000000 NUMBER_OF_FRAMES: 250860 NUMBER_OF_FRAMES-eng: 250860 NUMBER_OF_BYTES : 642201600 NUMBER_OF_BYTES-eng: 642201600 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:3(rus): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s Metadata: title : П.Гланц и И.Королева BPS : 640000 BPS-eng : 640000 DURATION : 02:13:47.488000000 DURATION-eng : 02:13:47.488000000 NUMBER_OF_FRAMES: 250859 NUMBER_OF_FRAMES-eng: 250859 NUMBER_OF_BYTES : 642199040 NUMBER_OF_BYTES-eng: 642199040 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:4(rus): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s Metadata: title : А.Гаврилов BPS : 640000 BPS-eng : 640000 DURATION : 02:13:47.104000000 DURATION-eng : 02:13:47.104000000 NUMBER_OF_FRAMES: 250847 NUMBER_OF_FRAMES-eng: 250847 NUMBER_OF_BYTES : 642168320 NUMBER_OF_BYTES-eng: 642168320 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:5(rus): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s Metadata: title : Ю.Живов BPS : 640000 BPS-eng : 640000 DURATION : 02:13:47.104000000 DURATION-eng : 02:13:47.104000000 NUMBER_OF_FRAMES: 250847 NUMBER_OF_FRAMES-eng: 250847 NUMBER_OF_BYTES : 642168320 NUMBER_OF_BYTES-eng: 642168320 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:6(rus): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s Metadata: title : А.Наследников BPS : 640000 BPS-eng : 640000 DURATION : 02:13:47.104000000 DURATION-eng : 02:13:47.104000000 NUMBER_OF_FRAMES: 250847 NUMBER_OF_FRAMES-eng: 250847 NUMBER_OF_BYTES : 642168320 NUMBER_OF_BYTES-eng: 642168320 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:7(ukr): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s Metadata: title : дублированный BPS : 448000 BPS-eng : 448000 DURATION : 02:13:47.456000000 DURATION-eng : 02:13:47.456000000 NUMBER_OF_FRAMES: 250858 NUMBER_OF_FRAMES-eng: 250858 NUMBER_OF_BYTES : 449537536 NUMBER_OF_BYTES-eng: 449537536 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:8(eng): Audio: dts, 48000 Hz, 5.1(side), s32p (24 bit) Metadata: title : DTS-HD MA 5.1 Оригинал BPS : 4074956 BPS-eng : 4074956 DURATION : 02:13:47.477000000 DURATION-eng : 02:13:47.477000000 NUMBER_OF_FRAMES: 752576 NUMBER_OF_FRAMES-eng: 752576 NUMBER_OF_BYTES : 4088952828 NUMBER_OF_BYTES-eng: 4088952828 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:9(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s Metadata: title : Оригинал BPS : 640000 BPS-eng : 640000 DURATION : 02:13:47.488000000 DURATION-eng : 02:13:47.488000000 NUMBER_OF_FRAMES: 250859 NUMBER_OF_FRAMES-eng: 250859 NUMBER_OF_BYTES : 642199040 NUMBER_OF_BYTES-eng: 642199040 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:10(rus): Subtitle: subrip (default) Metadata: title : Forced BPS : 0 BPS-eng : 0 DURATION : 01:49:56.672000000 DURATION-eng : 01:49:56.672000000 NUMBER_OF_FRAMES: 14 NUMBER_OF_FRAMES-eng: 14 NUMBER_OF_BYTES : 642 NUMBER_OF_BYTES-eng: 642 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:11(rus): Subtitle: subrip Metadata: title : Full BPS : 56 BPS-eng : 56 DURATION : 02:04:19.244000000 DURATION-eng : 02:04:19.244000000 NUMBER_OF_FRAMES: 914 NUMBER_OF_FRAMES-eng: 914 NUMBER_OF_BYTES : 52697 NUMBER_OF_BYTES-eng: 52697 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:12(ukr): Subtitle: subrip Metadata: title : Forced BPS : 0 BPS-eng : 0 DURATION : 01:49:56.672000000 DURATION-eng : 01:49:56.672000000 NUMBER_OF_FRAMES: 14 NUMBER_OF_FRAMES-eng: 14 NUMBER_OF_BYTES : 622 NUMBER_OF_BYTES-eng: 622 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:13(ukr): Subtitle: subrip Metadata: title : Full BPS : 55 BPS-eng : 55 DURATION : 02:04:19.072000000 DURATION-eng : 02:04:19.072000000 NUMBER_OF_FRAMES: 867 NUMBER_OF_FRAMES-eng: 867 NUMBER_OF_BYTES : 51649 NUMBER_OF_BYTES-eng: 51649 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:14(eng): Subtitle: subrip Metadata: title : Full BPS : 44 BPS-eng : 44 DURATION : 02:04:16.656000000 DURATION-eng : 02:04:16.656000000 NUMBER_OF_FRAMES: 1282 NUMBER_OF_FRAMES-eng: 1282 NUMBER_OF_BYTES : 41931 NUMBER_OF_BYTES-eng: 41931 _STATISTICS_WRITING_APP: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_APP-eng: mkvmerge v7.9.0 ('Birds') 64bit _STATISTICS_WRITING_DATE_UTC: 2018-09-22 21:50:22 _STATISTICS_WRITING_DATE_UTC-eng: 2018-09-22 21:50:22 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:15: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 477x600, 90k tbr, 90k tbn, 90k tbc (attached pic) Metadata: filename : cover mimetype : image/jpeg Invalid encoder type 'ac3' ```
shir commented 3 years ago

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.

rchovan commented 1 year ago

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:

obrázok

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 ?

ovizii commented 10 months ago

Problem happens here too despite the mentioned MigzImageRemovalPlugin.

image

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.

ovizii commented 8 months ago

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'
BjoernUsw commented 5 months ago

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.

ovizii commented 5 months ago

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

BjoernUsw commented 5 months ago

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.

grafik

ovizii commented 5 months ago

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)

BjoernUsw commented 5 months ago

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.

jackmaninov commented 3 months ago

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.

ShawnHardwick commented 3 months ago

@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?
    }
  }