Jellyfin Forum
Avoiding transcoding ... - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: General Questions (https://forum.jellyfin.org/f-general-questions)
+--- Thread: Avoiding transcoding ... (/t-avoiding-transcoding)

Pages: 1 2 3


RE: Avoiding transcoding ... - bitmap - 2025-01-13

Can you share either logs or what it says in the dashboard for "transcoding reason"? It will give you an idea of why it's transcoding. I think in the logs you could grep/search for "TranscodeReason" and find a key/value pair with a short description of the issue. Going to the dashboard and clicking on the "i" icon will also provide some clues or even the answer.


RE: Avoiding transcoding ... - jellyfin - 2025-01-14

(2025-01-13, 11:53 PM)bitmap Wrote: Can you share either logs or what it says in the dashboard for "transcoding reason"? It will give you an idea of why it's transcoding. I think in the logs you could grep/search for "TranscodeReason" and find a key/value pair with a short description of the issue. Going to the dashboard and clicking on the "i" icon will also provide some clues or even the answer.

I made some more tests and as it seems, I can disable all transcoding settings, but not the remux option:

The Dashboard explains why, see the attached screenshots.

Even as the video is H264 and the audio is AAC, which can both be DirectPlayed (with the Jellyfin App on iPadOS) the container is MKV - and this seems to be the problem and the reason why numerous files get created in the ../transcodes folder.

I did not read that from the JF Codec pages, and thought that only H265 codec does not work within MKV containers.

That is a big problem for me.

Tomorrow I may just try and create an MP4 or MPV(?) container and repeat the test.

I need my content to work without any transcoding, but I need my language, the original language and any commentary - also all subtitles for those languages. And from what I remember, only MKV allows this.


RE: Avoiding transcoding ... - bitmap - 2025-01-14

Can you do a mediainfo or ffprobe on the example media file? You may be able to fix this one issue with a single ffmpeg or mkvmerge remux. It's weird that the incompatible container is the issue.


RE: Avoiding transcoding ... - jellyfin - 2025-01-14

(2025-01-13, 11:53 PM)bitmap Wrote: Can you share either logs or what it says in the dashboard for "transcoding reason"? It will give you an idea [quote="bitmap" pid='48842' dateline='1736814197']
Can you do a mediainfo or ffprobe on the example media file? You may be able to fix this one issue with a single ffmpeg or mkvmerge remux. It's weird that the incompatible container is the issue.

Code:
[matroska,webm @ 0x154704bc0] Could not find codec parameters for stream 2 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x154704bc0] Could not find codec parameters for stream 3 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x154704bc0] Could not find codec parameters for stream 4 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x154704bc0] Could not find codec parameters for stream 5 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x154704bc0] Could not find codec parameters for stream 6 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from 'PRIDE_AND_PREJUDICE_H264_AAC_C1.mkv':
  Metadata:
    creation_time  : 2025-01-13T20:41:25.000000Z
    ENCODER        : Lavf61.7.100
  Duration: 00:07:19.61, start: -0.044000, bitrate: 6238 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1914x818 [SAR 1:1 DAR 957:409], 23.98 fps, 23.98 tbr, 1k tbn (default)
      Metadata:
        DURATION        : 00:07:19.523000000
  Stream #0:1(ger): Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
      Metadata:
        title          : Surround 5.1
        DURATION        : 00:07:19.552000000
  Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle (pgssub)
      Metadata:
        DURATION        : 00:07:10.013000000
  Stream #0:3(eng): Subtitle: hdmv_pgs_subtitle (pgssub)
      Metadata:
        DURATION        : 00:07:19.605000000
  Stream #0:4(ger): Subtitle: hdmv_pgs_subtitle (pgssub)
      Metadata:
        DURATION        : 00:07:10.096000000
  Stream #0:5(ger): Subtitle: hdmv_pgs_subtitle (pgssub)
      Metadata:
        DURATION        : 00:07:19.605000000
  Stream #0:6(ger): Subtitle: hdmv_pgs_subtitle (pgssub)
      Metadata:

One DURATION line missing, I have problems with the forum.

And from another test file:

Code:
[matroska,webm @ 0x121e06410] Could not find codec parameters for stream 2 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x121e06410] Could not find codec parameters for stream 3 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x121e06410] Could not find codec parameters for stream 4 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x121e06410] Could not find codec parameters for stream 5 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x121e06410] Could not find codec parameters for stream 6 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from 'PRIDE_AND_PREJUDICE_H264_AAC320_C1.mkv':
  Metadata:
    creation_time   : 2025-01-13T21:32:15.000000Z
    ENCODER         : Lavf61.7.100
  Duration: 00:07:19.61, start: -0.044000, bitrate: 6108 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1914x818 [SAR 1:1 DAR 957:409], 23.98 fps, 23.98 tbr, 1k tbn (default)
      Metadata:
        DURATION        : 00:07:19.523000000
  Stream #0:1(ger): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
      Metadata:
        title           : Surround 5.1
        DURATION        : 00:07:19.552000000
  Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle (pgssub)
      Metadata:
        DURATION        : 00:07:10.013000000
  Stream #0:3(eng): Subtitle: hdmv_pgs_subtitle (pgssub)
      Metadata:
        DURATION        : 00:07:19.605000000
  Stream #0:4(ger): Subtitle: hdmv_pgs_subtitle (pgssub)
      Metadata:
        DURATION        : 00:07:10.096000000
  Stream #0:5(ger): Subtitle: hdmv_pgs_subtitle (pgssub)
      Metadata:
        DURATION        : 00:07:19.605000000
  Stream #0:6(ger): Subtitle: hdmv_pgs_subtitle (pgssub)
      Metadata:
        DURATION        : 00:00:00.000000000



RE: Avoiding transcoding ... - jellyfin - 2025-01-14

I only found ffprobe 😅


RE: Avoiding transcoding ... - jellyfin - 2025-01-14

(2025-01-14, 12:23 AM)bitmap Wrote: Can you do a mediainfo or ffprobe on the example media file? You may be able to fix this one issue with a single ffmpeg or mkvmerge remux. It's weird that the incompatible container is the issue.

I installed MediaInfo and used it on 2 full versions of a BluRay conversion with different audio tracks.


RE: Avoiding transcoding ... - jellyfin - 2025-01-14

OK, I made some more tests.

First let me say that the above link says that h.265 / HEVC on Safari or iOS is "is only supported in MP4, M4V, and MOV containers."
That does not seem to be true!
-> I can play H265 from a MKV container and it will be shown as "direct" in the JF dashboard! 

But then, h.264 should work in any container.
That does not seem to be true!
-> I can play H264 from a MKV as "direct" but it still get's remixed!

Something is wrong here.

For this, I created both H264 and H265 videos in a MKV container - and the Dashboard in both cases says that the video is played "Direct".

Also, in both cases, the video get's remuxed - because of the container!
I repeated the same with videos without any audio and then even without any subtitles, just to be sure - same behaviour!

And, I see new 76 files to be created in the transcodes cache, directly after starting the video - together they have the same size as my test file!

That means, that watching any video will rewrite the same amount of data to disk - every time I watch a video! This is not how it should work.
I need to get rid of this.

I will now create other containers and test with them!

Before, this is the full MediaInfo output for the file without audio and subtitles:

Code:
General

Unique ID : 196208340346919720067586282130649630699 (0x939C5A0FA5D1FD15BAA628E04FB3C7EB)
Complete name : /Volumes/WDBLACK/CACHES/PRIDE_AND_PREJUDICE_2005-standard265NoAudioNoSubtitles.mkv
Format : Matroska
Format version : Version 4
File size : 275 MiB
Duration : 7 min 19 s
Overall bit rate : 5 255 kb/s
Frame rate : 23.976 FPS
Movie name :
Encoded date : 2025-01-14 17:17:33 UTC
Writing application : HandBrake 1.9.0 2024120100
Writing library : Lavf61.7.100
ErrorDetectionType : Per level 1
Video

ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main 10@L4@Main
Codec ID : V_MPEGH/ISO/HEVC
Duration : 7 min 19 s
Bit rate : 5 150 kb/s
Width : 1 914 pixels
Height : 818 pixels
Display aspect ratio : 2.35:1
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0 (Type 0)
Bit depth : 10 bits
Bits/(Pixel*Frame) : 0.137
Stream size : 270 MiB (98%)
Writing library : x265 4.1+1-1d117be:[Mac OS X][clang 16.0.0][64 bit] 10bit
Encoding settings : cpuid=98 / frame-threads=8 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1914x818 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-eob / no-eos / no-hrd / info / hash=0 / temporal-layers=0 / open-gop / min-keyint=24 / keyint=240 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / no-hist-scenecut / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=1 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / no-strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=4 / selective-sao=4 / no-early-skip / rskip / rskip-edge-threshold=0.050000 / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=0.75 / psy-rdoq=4.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=22.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=1 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=1 / transfer=1 / colormatrix=1 / chromaloc=1 / chromaloc-top=0 / chromaloc-bottom=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass / no-mcstf / no-sbrc / no-frame-rc
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709



RE: Avoiding transcoding ... - jellyfin - 2025-01-14

I can confirm that there is a problem with the MKV container!

As soon as I use MP4, the files get played directly and also without remuxing - and YES, there are NO files in the "transcodes" cache anymore!

If this is NOT the expected behaviour (which I assume), then this is bug - either in Jellyfin server or client.
OR, in what both makemkv and Handbrake produce in MKV containers.


RE: Avoiding transcoding ... - Efficient_Good_5784 - 2025-01-14

That's expected behavior. MKVs are not widely supported by all clients to begin with. MP4 are, so there's way less of a chance that MP4 containers will cause a remux.

What Jellyfin is doing is remuxing your MKV container to MP4 so that the client can play it.
This is not a bug. The client just can't handle MKV containers most likely.

In order to remux, Jellyfin needs to store the final result in the transcode directory where it's then sent to the client for playback.


RE: Avoiding transcoding ... - bitmap - 2025-01-14

Just to clarify, remuxing is not the same as transcoding. Remuxing when a client reports it is not compatible with the container is the expected behavior and remuxing uses *very few* cycles (i.e., small amount of CPU or GPU). Transcode/remux files in cache are temporary and cleared out on whatever schedule is set in your Scheduled Tasks. I would not fret about this, very much the expected behavior.