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


Avoiding transcoding ... - jellyfin - 2025-01-13

I am quite happy with my Jellyfin server, but I noticed that all my DVD and BluRay rips (makemkv) get transcoded by Jellyfin.

This is something that should ideally be avoided.

From https://jellyfin.org/docs/general/clients/codec-support/ I got the impression that H264 8-Bit should be the most compatible video codec, esp. for Jellyfin clients or playing over a web browser.
This should allow for DirectPlay on most clients, if I read correctly.

I would need to stay at "mkv" containers, because of multiple audio and subtitle tracks.

Currently, I struggle with the audio codec to be used.

IIRC, DTS often cannot be used over DirectPlay and I read that AAC and AC3 are the most compatible.

I read that AAC is more modern and supports high-quality audio, but for my goals, AC3 seems to be the way to go, being more compatible.

But the above link shows that AAC is more compatible.

So what should I use to avoid transcoding?

And finally, what to do with the bitrate?

I often see such audio tracks:

DTS 5.1ch 768 kpps
DTS 5.1ch 1536 kbps

Convert to AC3 5.1ch 48k and WHAT bitrate?
Somewhere, I read that 448  should be used.

I sometimes see DTS-HD MA which is uncompressed audio, IIRC.
That should be skipped for the goal of saving space and avoiding transcoding.


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

Codec support varies greatly between clients and devices. And for audio some devices have a maximum number of channels they support. I'm assuming the audio is what is getting transcoded most of the time. I also wouldn't be surprised if the DVDs are also getting transcoded as many new devices don't support MPEG2 anymore.

We'd need to see your ffmpeg logs to figure out what is getting transcoded.


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

(2025-01-13, 08:05 PM)TheDreadPirate Wrote: Codec support varies greatly between clients and devices.  And for audio some devices have a maximum number of channels they support.  I'm assuming the audio is what is getting transcoded most of the time.  I also wouldn't be surprised if the DVDs are also getting transcoded as many new devices don't support MPEG2 anymore.

We'd need to see your ffmpeg logs to figure out what is getting transcoded.

The DVDs are just ripped with makemkv, so they are not H264.
I need to re-encode them to avoid that, from what I read at https://jellyfin.org/docs/general/clients/codec-support

My question above was about the audio codec - do you probably have a hint for me?

AC3?
AAC?
Some say AC3 is most compatible and best to avoid transcoding, but the above link says AAC is better.

At what bitrates, coming from DTS 5.1ch 768 or 1536 kbps?
Any recommendation?

Many thanks!


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

The Jellyfin client on iPadOS seems to transcode even AC3 to AAC.

The "Direct Streaming Info" shows "Audio codec: AAC", regardless if the track was AAC, AC3 or DTS.

So that should answer my question, it seems.

I should use AAC to avoid any transcoding.


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

Honestly, either is likely fine. They're both established codecs. If you want the best quality, avoid re-encoding lossy formats (this is why DTS-HD MA, FLAC, TrueHD, and other lossless codecs exist). If you need to increase compatibility and don't mind the artifacting, clipping, or other loss of quality, pick what user clients support. I would venture 768 kbps is more than enough. If you look at Opus, for example, around 160 kbps provides transparency in stereo audio -- double that for 5.1 and it's still great. Something like AAC I would want more like 256 kbps minimum for stereo and maybe 512 kbps for surround.

These are all subjective, though. They depend highly on your hearing ability (mine is quite damaged), client and personal setups (e.g., home theater system, sound bar, TV speakers), and client devices (e.g., Roku, Firestick, Jellyfin Media Player, web).

(2025-01-13, 08:33 PM)jellyfin Wrote: The Jellyfin client on iPadOS seems to transcode even AC3 to AAC.

The "Direct Streaming Info" shows "Audio codec: AAC", regardless if the track was AAC, AC3 or DTS.

So that should answer my question, it seems.

I should use AAC to avoid any transcoding.

So this is likely audio transcoding and remuxing. Not a big deal and does not trigger video transcoding, which is what you should be most worried about. Also forgot in my last post, make sure the audio is 5.1 channels or less (i.e., 5.1, stereo, dual/single mono).


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

AAC is the most compatible codec you can use. The bit rate should be 64Kbps PER CHANNEL. 2 channel = 128Kbps. 6 channels (5.1) = 384Kbps. And so on.


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

Great many thanks. @bitmap and @TheDreadPirate!

I created a test file with a single AAC track (and H264) to check if this avoid transcoding.

But ffmpeg still get's executed:

Code:
[2025-01-13 22:00:48.894 +01:00] [INF] [90] Jellyfin.Api.Helpers.MediaInfoHelper: User policy for "user". EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[2025-01-13 22:00:49.249 +01:00] [INF] [3] MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: "/Applications/Jellyfin.app/Contents/MacOS/ffmpeg" "-analyzeduration 200M -probesize 1G -fflags +genpts -f matroska  -i file:\"/Volumes/MEDIA/CONTENT/MOVIES/PRIDE_AND_PREJUDICE_2005/PRIDE_AND_PREJUDICE_H264_AAC_C1.mkv\" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 copy -bsf:v h264_mp4toannexb -start_at_zero -codec:a:0 aac_at -ac 2 -ab 256000 -af \"volume=2\" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 6 -hls_segment_type fmp4 -hls_fmp4_init_filename \"0594744946fabc12f84ceea5ee1051df-1.mp4\" -start_number 0 -hls_segment_filename \"/Users/user/Library/Application Support/jellyfin/cache/transcodes/0594744946fabc12f84ceea5ee1051df%d.mp4\" -hls_playlist_type vod -hls_list_size 0 -y \"/Users/user/Library/Application Support/jellyfin/cache/transcodes/0594744946fabc12f84ceea5ee1051df.m3u8\""
[2025-01-13 22:00:53.003 +01:00] [INF] [3] MediaBrowser.MediaEncoding.Transcoding.TranscodeManager: FFmpeg exited with code 0


And I still see LOTS of files below ~/Library/Application\ Support/jellyfin/cache/transcodes:

Code:
-rw-r--r--@ 1 tja  staff      1361 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df-1.mp4
-rw-r--r--@ 1 tja  staff  3444137 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df0.mp4
-rw-r--r--@ 1 tja  staff  4257370 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df1.mp4
-rw-r--r--@ 1 tja  staff  1102513 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df2.mp4
-rw-r--r--@ 1 tja  staff  1114032 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df3.mp4
-rw-r--r--@ 1 tja  staff  2581530 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df4.mp4
-rw-r--r--@ 1 tja  staff  3420159 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df5.mp4
-rw-r--r--@ 1 tja  staff  3928152 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df6.mp4
-rw-r--r--@ 1 tja  staff  4867317 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df7.mp4
-rw-r--r--@ 1 tja  staff  6283568 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df8.mp4
-rw-r--r--@ 1 tja  staff  9507165 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df9.mp4
-rw-r--r--@ 1 tja  staff  9132510 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df10.mp4
-rw-r--r--@ 1 tja  staff  7729512 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df11.mp4
-rw-r--r--@ 1 tja  staff  6501036 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df12.mp4
-rw-r--r--@ 1 tja  staff  5132511 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df13.mp4
-rw-r--r--@ 1 tja  staff  6142349 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df14.mp4
-rw-r--r--@ 1 tja  staff  3697508 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df15.mp4
-rw-r--r--@ 1 tja  staff  4249490 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df16.mp4
-rw-r--r--@ 1 tja  staff  6434149 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df17.mp4
-rw-r--r--@ 1 tja  staff  4630903 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df18.mp4
-rw-r--r--@ 1 tja  staff  6291989 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df19.mp4
-rw-r--r--@ 1 tja  staff  2314486 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df20.mp4
-rw-r--r--@ 1 tja  staff  3725373 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df21.mp4
-rw-r--r--@ 1 tja  staff  13749608 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df22.mp4
-rw-r--r--@ 1 tja  staff  3101756 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df23.mp4
-rw-r--r--@ 1 tja  staff  2819417 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df24.mp4
-rw-r--r--@ 1 tja  staff  8799467 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df25.mp4
-rw-r--r--@ 1 tja  staff  11601028 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df26.mp4
-rw-r--r--@ 1 tja  staff  1441272 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df27.mp4
-rw-r--r--@ 1 tja  staff  4091336 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df28.mp4
-rw-r--r--@ 1 tja  staff  5594222 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df29.mp4
-rw-r--r--@ 1 tja  staff  2791765 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df30.mp4
-rw-r--r--@ 1 tja  staff    885411 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df31.mp4
-rw-r--r--@ 1 tja  staff  2119006 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df32.mp4
-rw-r--r--@ 1 tja  staff  1679547 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df33.mp4
-rw-r--r--@ 1 tja  staff  1573869 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df34.mp4
-rw-r--r--@ 1 tja  staff  1534351 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df35.mp4
-rw-r--r--@ 1 tja  staff  1120546 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df36.mp4
-rw-r--r--@ 1 tja  staff  1281904 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df37.mp4
-rw-r--r--@ 1 tja  staff  1945745 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df38.mp4
-rw-r--r--@ 1 tja  staff  1155531 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df39.mp4
-rw-r--r--@ 1 tja  staff  3843598 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df40.mp4
-rw-r--r--@ 1 tja  staff  12146766 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df41.mp4
-rw-r--r--@ 1 tja  staff  5553562 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df42.mp4
-rw-r--r--@ 1 tja  staff  8376327 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df43.mp4
-rw-r--r--@ 1 tja  staff  7736080 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df44.mp4
-rw-r--r--@ 1 tja  staff  6844193 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df45.mp4
-rw-r--r--@ 1 tja  staff  8388941 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df46.mp4
-rw-r--r--@ 1 tja  staff  8452883 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df47.mp4
-rw-r--r--@ 1 tja  staff  3948250 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df48.mp4
-rw-r--r--@ 1 tja  staff  9872536 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df49.mp4
-rw-r--r--@ 1 tja  staff  12661761 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df50.mp4
-rw-r--r--@ 1 tja  staff  11363182 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df51.mp4
-rw-r--r--@ 1 tja  staff  7630908 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df52.mp4
-rw-r--r--@ 1 tja  staff  3815405 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df53.mp4
-rw-r--r--@ 1 tja  staff  2705807 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df54.mp4
-rw-r--r--@ 1 tja  staff  5828105 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df55.mp4
-rw-r--r--@ 1 tja  staff  6602322 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df56.mp4
-rw-r--r--@ 1 tja  staff  5783720 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df57.mp4
-rw-r--r--@ 1 tja  staff  9057551 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df58.mp4
-rw-r--r--@ 1 tja  staff  2495435 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df59.mp4
-rw-r--r--@ 1 tja  staff  3754756 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df60.mp4
-rw-r--r--@ 1 tja  staff      3652 Jan 13 22:00 0594744946fabc12f84ceea5ee1051df.m3u8

So this does not avoid transcoding.

I will test again with disabling transcoding for the user.


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

I can neither disable audio nor video transcoding.

When I try, the video cannot get played anymore!

"Playback failed because the media is not supported by this client" (from the Jellyfin iPadOS client)

This needs more time and tests, I fear.

EDIT:

I noticed that my AAC audio has a bitrate of 320 instead of 448 which I set Handbrake to.
Maybe this plays part in why the file still get's transcoded.

I will repeat with 320 instead of 448, even as I don't understand why not 448 got used (from the original DTS 768 track).


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

How many channels are in the original audio?


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

(2025-01-13, 09:16 PM)TheDreadPirate Wrote: How many channels are in the original audio?

The original tracks are DTS 5.1ch 768 kbps and DTS 5.1ch 1536 kbps

For the test I used the "DTS 5.1ch 768 kbps" and converted to AAC 5.1ch sample rate 48 and bitrate 448, but Jellyfin says that the file only has 320 instead of 448.

EDIT:
I am creating a new test, using only a AAC stereo track

EDIT 2:
Not even this get's play when transcoding is disabled.

I give up for today