HaveAGitGat / Tdarr_Plugins

Tdarr Plugins
GNU General Public License v3.0
137 stars 156 forks source link

burn in subtitles option? #671

Open picarica opened 3 months ago

picarica commented 3 months ago

hello i got sent here from main issues [https://github.com/HaveAGitGat/Tdarr/issues/1022](this is the issue i did)

i wondere if anyobyd acchieved it with built in plugins, i tried and my issues are link above

HaveAGitGat commented 3 months ago

Hi what was the error? The error is in the section above. Where the first red X is in the screenshot?

HaveAGitGat commented 3 months ago

Here I mean, the error should be there: image

picarica commented 3 months ago

sorry for late reply

341668104-84c7b86b-558b-4539-9694-4a6b6981ab23

basically i thin kth error is with ffmpeg i need to input subtitle file and when its embede it should be name of current file, but well it changes on every encode

HaveAGitGat commented 3 months ago

I think you need to scroll down to see the error.

picarica commented 3 months ago

I think you need to scroll down to see the error.

no this was it, whole secriont, still the issue prestist how can input current files name into subtitles=*.mkv

HaveAGitGat commented 3 months ago

It would be easier if you post the job report or link to pastebin so can check the details. There’s a copy/download button at the top of the job report page so can easily copy or download it.

picarica commented 3 months ago

ptPZqor_Sz5-log.txt got it sorry

HaveAGitGat commented 3 months ago
2024-06-24T08:02:27.842Z [Parsed_subtitles_0 @ 0x558fb3a0a700] Unable to open "input.mkv
2024-06-24T08:02:27.842Z [AVFilterGraph @ 0x558fb3a0a0c0] Error initializing filters
2024-06-24T08:02:27.842Z 
2024-06-24T08:02:27.842Z Error reinitializing filters!
2024-06-24T08:02:27.842Z Failed to inject frame into filter network: No such file or directory
2024-06-24T08:02:27.842Z Error while processing the decoded data for stream #0:0
2024-06-24T08:02:27.842Z 
2024-06-24T08:02:27.842Z Conversion failed!

Yeah you can’t use input.mkv, would need to use the actual file path which you can’t do with classic plugins.

You can do it using the flow plugin Run CLI where you can specify custom commands including input files so should work with that.

picarica commented 3 months ago

hmm how would i go about that? in Run CLI flow i only see mkvmerge option, how would i i use ffmpeg inside?

HaveAGitGat commented 3 months ago

Enable the custom CLI option and put ffmpeg

picarica commented 3 months ago

can i somewhere find all options and variables avalaible? i tried this -i ${fileName} -c:v libx265 -vf subtitles="${fileName}:stream_index=0:force_style='PrimaryColour=&H00ffff&'" -map 0:v -map 0:a -c:a copy "${outputFilePath}" like so image

and my flow is

image

but seems like the variable ${fileName} is non valid? in the output error there is variable present in plaintext Cxmpmr2oo-log.txt

HaveAGitGat commented 3 months ago

There’s some info in the example but use

{{{args.inputFileObj._id}}} instead of ${fileName} and it should work.

picarica commented 3 months ago

`2024-06-24T12:03:25.302Z Error reinitializing filters!

64

2024-06-24T12:03:25.302Z Failed to inject frame into filter network: No such file or directory

65

2024-06-24T12:03:25.302Z Error while processing the decoded data for stream #0:0

66

2024-06-24T12:03:25.302Z Conversion failed!`

something stills wrong i wonder if the checkbox output fiele bcomes working files is acusing this ? bg3WrPARx-log.txt

HaveAGitGat commented 3 months ago

The command is:

/usr/local/bin/ffmpeg -i /media/shows/Rick.And.Morty.S04.COMPLETE.1080p.Bluray.NVENC.x264-SURGE/Rick.And.Morty.S04E03.1080p.Bluray.NVENC.x264-SURGE.mkv -c:v libx265 -vf subtitles="/media/shows/Rick.And.Morty.S04.COMPLETE.1080p.Bluray.NVENC.x264-SURGE/Rick.And.Morty.S04E03.1080p.Bluray.NVENC.x264-SURGE.mkv:stream_index=0:force_style='PrimaryColour=&H00ffff&'" -c:a copy /app/configs/tdarr-workDir-node-BP0DzHRlI-worker-lame-lark-ts-1719223399039/1719223402325/Rick.And.Morty.S04E03.1080p.Bluray.NVENC.x264-SURGE.mkv

Try running it in the container manually in the terminal not using Tdarr. The output folder probably won’t exist when running it manually so either create it or just put it somewhere else.

Also I see your library cache folder is /app/configs, nothing wrong with that but you might want to put it somewhere else.

picarica commented 3 months ago

i tried i got this error first

root@tdarr-cfcf8f5fd-dr7kv:/app/configs# mkdir tdarr-workDir-node-BP0DzHRlI-worker-lame-lark-ts-1719223399039
mkdir: cannot create directory ‘tdarr-workDir-node-BP0DzHRlI-worker-lame-lark-ts-1719223399039’: Permission denied

so just did

/usr/local/bin/ffmpeg -i /media/shows/Rick.And.Morty.S04.COMPLETE.1080p.Bluray.NVENC.x264-SURGE/Rick.And.Morty.S04E03.1080p.Bluray.NVENC.x264-SURGE.mkv -c:v libx265 -vf subtitles="/media/shows/Rick.And.Morty.S04.COMPLETE.1080p.Bluray.NVENC.x264-SURGE/Rick.And.Morty.S04E03.1080p.Bluray.NVENC.x264-SURGE.mkv:stream_index=0:force_style='PrimaryColour=&H00ffff&'" -c:a copy /media/test.mkv

but then it just worked, is the permission denied an error? how could it be its a docker container

ffmpeg version 6.0-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.2)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, matroska,webm, from '/media/shows/Rick.And.Morty.S04.COMPLETE.1080p.Bluray.NVENC.x264-SURGE/Rick.And.Morty.S04E03.1080p.Bluray.NVENC.x264-SURGE.mkv':
  Metadata:
    title           : Rick.And.Morty.S04E03.1080p.Bluray.NVENC.x264-SURGE
    creation_time   : 2022-08-22T18:27:39.000000Z
    ENCODER         : Lavf58.76.100
  Duration: 00:22:38.13, start: 0.000000, bitrate: 2202 kb/s
  Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:22:38.128000000
  Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      title           : English
      DURATION        : 00:22:38.079000000
  Stream #0:2(eng): Subtitle: ass
    Metadata:
      title           : English
      DURATION        : 00:22:29.536000000
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (ass (ssa) -> ass (ssa))
Press [q] to stop, [?] for help
[Parsed_subtitles_0 @ 0x5590a3b30e40] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 2.6.4 (COMPLEX)
[Parsed_subtitles_0 @ 0x5590a3b30e40] Using font provider fontconfig
x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe
x265 [info]: build info [Linux][GCC 9.3.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / wpp(17 rows)
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 23 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
Output #0, matroska, to '/media/test.mkv':
  Metadata:
    title           : Rick.And.Morty.S04E03.1080p.Bluray.NVENC.x264-SURGE
    encoder         : Lavf60.3.100
  Stream #0:0: Video: hevc, yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 1k tbn (default)
    Metadata:
      DURATION        : 00:22:38.128000000
      encoder         : Lavc60.3.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1(eng): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp (default)
    Metadata:
      title           : English
      DURATION        : 00:22:38.079000000
  Stream #0:2(eng): Subtitle: ass
    Metadata:
      title           : English
      DURATION        : 00:22:29.536000000
      encoder         : Lavc60.3.100 ssa
[Parsed_subtitles_0 @ 0x5590a3b30e40] fontselect: (sans-serif, 400, 0) -> /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf, 0, DejaVuSans
frame= 1860 fps= 30 q=35.8 size=    7680kB time=00:01:19.06 bitrate= 795.8kbits/s speed=1.26x

here is full progres and it seems to work fine

should i use different output,? i would like to replace the original when done

picarica commented 3 months ago

ye seems like output is issue? 2024-06-24T13:53:19.786Z [NULL @ 0x56053241fa00] Unable to find a suitable output format for '/app/configs/tdarr-workDir-node-BP0DzHRlI-worker-zesty-zebu-ts-1719229980125/1719229995970/Rick.And.Morty.S04E01.1080p.Bluray.NVENC.x264-SURGE.'

picarica commented 3 months ago

any updates? i still couldnt get it towork, i tried chowning that directory and stuff like that, but its all in truenas with ixvolumes no permission issue should exist

HaveAGitGat commented 3 months ago

The permission denied error may be because the parent folde does not exist, try this:

mkdir -p /app/configs/tdarr-workDir-node-BP0DzHRlI-worker-lame-lark-ts-1719223399039/1719223402325/

/usr/local/bin/ffmpeg -i /media/shows/Rick.And.Morty.S04.COMPLETE.1080p.Bluray.NVENC.x264-SURGE/Rick.And.Morty.S04E03.1080p.Bluray.NVENC.x264-SURGE.mkv -c:v libx265 -vf subtitles="/media/shows/Rick.And.Morty.S04.COMPLETE.1080p.Bluray.NVENC.x264-SURGE/Rick.And.Morty.S04E03.1080p.Bluray.NVENC.x264-SURGE.mkv:stream_index=0:force_style='PrimaryColour=&H00ffff&'" -c:a copy /app/configs/tdarr-workDir-node-BP0DzHRlI-worker-lame-lark-ts-1719223399039/1719223402325/Rick.And.Morty.S04E03.1080p.Bluray.NVENC.x264-SURGE.mkv
picarica commented 3 months ago

mkdir -p /app/configs/tdarr-workDir-node-BP0DzHRlI-worker-lame-lark-ts-1719223399039/1719223402325/

 mkdir -p /app/configs/tdarr-workDir-node-BP0DzHRlI-worker-lame-lark-ts-1719223399039/1719223402325/
mkdir: cannot create directory ‘/app/configs/tdarr-workDir-node-BP0DzHRlI-worker-lame-lark-ts-1719223399039’: Permission denied

well i am fumbled