Jellyfin and Plex both failing to transcode

Hi Tolriq! I love your app!

Issue description:
I’m using Yatse to connect to my jellyfin server. When playing a local movie file (with either Mx Player or VLC) I find it doesn’t work unless I’ve checked “Only transcode if mandatory”. The jellyfin recognizes it as playing in the case of MX player, but no video shows up on the MX player. On VLC, the server recognizes a video file getting played, but closes at the same speed that VLC closes.
Logs:
debug-20191220_222907.zip (26.8 KB)
Screenshots:

Additional information:

  • I notice on the jellyfin side that it’s treating MX player as “direct play” which means it isn’t trying to transcode. I also noticed if I modify my supported audio codec settings I can actually change the “direct play” to “direct stream” suggesting the server noticed it needed to transcode the audio.
  • I’ve tried setting a minimum WIFI bitrate as well as a maximum WIFI bitrate. I don’t find it changes anything about the issue.
  • In the logs I played one video file with the “Only transcode if mandatory” option unchecked, and then checked it and played it again. This was with MX player and it only actually played the second time.

In those logs you seems to have selected a wifi limit of 1Mb Jellyfin says he can’t transcode such low values.
Would require the Jellyfin logs and probably see with them if there’s a reason.
But try without setting a limit. The other test disable transcoding so it’s basic streaming and works.

Yatse only sends your configuration to the server that decide how media should be transcoded, when it does not work it’s most of the time something on the server side and server side logs are necessary too.

Thank you Tolriq! I woke up the next morning take a look at some Jellyfin logs. I just grabbed a representative one that more or less lines up with the yatse logs I sent. I haven’t correlated the two. However, I can clearly see a problem with jellyfin in regards to transcoding. It calls ffmpeg repeatedly, but it exists with “code 1” and ends up failing to transcode.

[2019-12-20 22:27:59.334 -08:00] [WRN] HTTP Response 200 to "192.168.0.3". Time (slow): 0:00:00.7662454. "http://192.168.0.20:8096/Items/a868394753c1784b72c26bcd9a99ba03/Images/Primary"
[2019-12-20 22:28:01.602 -08:00] [WRN] HTTP Response 200 to "192.168.0.3". Time (slow): 0:00:00.6009514. "http://192.168.0.20:8096/Items/4b6c4a2890ab2bea460cc72101d7ea47/Images/Primary"
[2019-12-20 22:28:04.766 -08:00] [INF] User policy for "craig". EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[2019-12-20 22:28:04.766 -08:00] [INF] Bitrate exceeds DirectPlay limit: media bitrate: 7041275, max bitrate: 2000000
[2019-12-20 22:28:04.766 -08:00] [INF] Bitrate exceeds DirectStream limit: media bitrate: 7041275, max bitrate: 2000000
[2019-12-20 22:28:04.766 -08:00] [INF] Profile: "Unknown Profile", Path: "/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv", isEligibleForDirectPlay: False, isEligibleForDirectStream: False
[2019-12-20 22:28:04.766 -08:00] [INF] RemoteClientBitrateLimit: 10000000, RemoteIp: "192.168.0.3", IsInLocalNetwork: True
[2019-12-20 22:28:04.766 -08:00] [INF] Bitrate exceeds DirectPlay limit: media bitrate: 7041275, max bitrate: 2000000
[2019-12-20 22:28:04.766 -08:00] [INF] Bitrate exceeds DirectStream limit: media bitrate: 7041275, max bitrate: 2000000
[2019-12-20 22:28:04.766 -08:00] [INF] Profile: "Unknown Profile", Path: "/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv", isEligibleForDirectPlay: False, isEligibleForDirectStream: False
[2019-12-20 22:28:04.766 -08:00] [INF] RemoteClientBitrateLimit: 10000000, RemoteIp: "192.168.0.3", IsInLocalNetwork: True
[2019-12-20 22:28:04.766 -08:00] [INF] Bitrate exceeds DirectPlay limit: media bitrate: 7041275, max bitrate: 2000000
[2019-12-20 22:28:04.766 -08:00] [INF] Bitrate exceeds DirectStream limit: media bitrate: 7041275, max bitrate: 2000000
[2019-12-20 22:28:04.766 -08:00] [INF] Profile: "Unknown Profile", Path: "/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv", isEligibleForDirectPlay: False, isEligibleForDirectStream: False
[2019-12-20 22:28:04.835 -08:00] [INF] Playback stopped reported by app "Android" "9" playing "Ad Astra". Stopped at "0" ms
[2019-12-20 22:28:05.961 -08:00] [INF] /usr/lib/jellyfin-ffmpeg/ffmpeg -i file:"/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_nvenc -pix_fmt yuv420p -preset default -b:v 1616000 -maxrate 1616000 -bufsize 3232000 -force_key_frames:0 "expr:gte(t,0+n_forced*3)" -vf "scale=trunc(min(max(iw\,ih*dar)\,720)/2)*2:trunc(ow/dar/2)*2" -copyts -vsync -1 -codec:a:0 ac3 -ac 6 -ab 384000  -f hls -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -hls_time 3 -individual_header_trailer 0 -hls_segment_type mkv -start_number 0 -hls_segment_filename "/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b145%d.mkv" -hls_playlist_type vod -hls_list_size 0 -y "/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b145.m3u8"
[2019-12-20 22:28:06.473 -08:00] [ERR] FFMpeg exited with code 1
[2019-12-20 22:28:06.499 -08:00] [WRN] cannot serve "/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b1450.mkv" as transcoding quit before we got there
[2019-12-20 22:28:06.500 -08:00] [ERR] Error processing request: "Could not find file '/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b1450.mkv'."
[2019-12-20 22:28:06.500 -08:00] [WRN] HTTP Response 404 to "192.168.0.3". Time (slow): 0:00:00.5403174. "http://192.168.0.20:8096/videos/7eca936e-2cd8-7fb2-b7b4-ae69a808b01c/hls1/main/0.mkv?DeviceId=7b4894ab73e9586a&MediaSourceId=7eca936e2cd87fb2b7b4ae69a808b01c&VideoCodec=h264&AudioCodec=ac3,eac3&AudioStreamIndex=1&VideoBitrate=1616000&AudioBitrate=384000&PlaySessionId=8f6be6a6d306492b81eed307bd1fc8e8&TranscodingMaxAudioChannels=6&CopyTimestamps=true&RequireAvc=false&Tag=0e9639f8e0ec8e385c8cae660a30f006&SegmentContainer=mkv&BreakOnNonKeyFrames=False&TranscodeReasons=ContainerBitrateExceedsLimit"
[2019-12-20 22:28:06.623 -08:00] [INF] /usr/lib/jellyfin-ffmpeg/ffmpeg -ss 00:00:03.000 -noaccurate_seek -i file:"/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_nvenc -pix_fmt yuv420p -preset default -b:v 1616000 -maxrate 1616000 -bufsize 3232000 -force_key_frames:0 "expr:gte(t,3+n_forced*3)" -vf "scale=trunc(min(max(iw\,ih*dar)\,720)/2)*2:trunc(ow/dar/2)*2" -copyts -vsync -1 -codec:a:0 ac3 -ac 6 -ab 384000  -f hls -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -hls_time 3 -individual_header_trailer 0 -hls_segment_type mkv -start_number 1 -hls_segment_filename "/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b145%d.mkv" -hls_playlist_type vod -hls_list_size 0 -y "/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b145.m3u8"
[2019-12-20 22:28:07.223 -08:00] [ERR] FFMpeg exited with code 1
[2019-12-20 22:28:07.250 -08:00] [WRN] cannot serve "/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b1451.mkv" as transcoding quit before we got there
[2019-12-20 22:28:07.251 -08:00] [ERR] Error processing request: "Could not find file '/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b1451.mkv'."
[2019-12-20 22:28:07.251 -08:00] [WRN] HTTP Response 404 to "192.168.0.3". Time (slow): 0:00:00.6298277. "http://192.168.0.20:8096/videos/7eca936e-2cd8-7fb2-b7b4-ae69a808b01c/hls1/main/1.mkv?DeviceId=7b4894ab73e9586a&MediaSourceId=7eca936e2cd87fb2b7b4ae69a808b01c&VideoCodec=h264&AudioCodec=ac3,eac3&AudioStreamIndex=1&VideoBitrate=1616000&AudioBitrate=384000&PlaySessionId=8f6be6a6d306492b81eed307bd1fc8e8&TranscodingMaxAudioChannels=6&CopyTimestamps=true&RequireAvc=false&Tag=0e9639f8e0ec8e385c8cae660a30f006&SegmentContainer=mkv&BreakOnNonKeyFrames=False&TranscodeReasons=ContainerBitrateExceedsLimit"
[2019-12-20 22:28:07.351 -08:00] [INF] /usr/lib/jellyfin-ffmpeg/ffmpeg -ss 00:00:06.000 -noaccurate_seek -i file:"/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_nvenc -pix_fmt yuv420p -preset default -b:v 1616000 -maxrate 1616000 -bufsize 3232000 -force_key_frames:0 "expr:gte(t,6+n_forced*3)" -vf "scale=trunc(min(max(iw\,ih*dar)\,720)/2)*2:trunc(ow/dar/2)*2" -copyts -vsync -1 -codec:a:0 ac3 -ac 6 -ab 384000  -f hls -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -hls_time 3 -individual_header_trailer 0 -hls_segment_type mkv -start_number 2 -hls_segment_filename "/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b145%d.mkv" -hls_playlist_type vod -hls_list_size 0 -y "/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b145.m3u8"
[2019-12-20 22:28:07.840 -08:00] [ERR] FFMpeg exited with code 1
[2019-12-20 22:28:07.899 -08:00] [WRN] cannot serve "/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b1452.mkv" as transcoding quit before we got there
[2019-12-20 22:28:07.899 -08:00] [ERR] Error processing request: "Could not find file '/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b1452.mkv'."
[2019-12-20 22:28:07.899 -08:00] [WRN] HTTP Response 404 to "192.168.0.3". Time (slow): 0:00:00.5511975. "http://192.168.0.20:8096/videos/7eca936e-2cd8-7fb2-b7b4-ae69a808b01c/hls1/main/2.mkv?DeviceId=7b4894ab73e9586a&MediaSourceId=7eca936e2cd87fb2b7b4ae69a808b01c&VideoCodec=h264&AudioCodec=ac3,eac3&AudioStreamIndex=1&VideoBitrate=1616000&AudioBitrate=384000&PlaySessionId=8f6be6a6d306492b81eed307bd1fc8e8&TranscodingMaxAudioChannels=6&CopyTimestamps=true&RequireAvc=false&Tag=0e9639f8e0ec8e385c8cae660a30f006&SegmentContainer=mkv&BreakOnNonKeyFrames=False&TranscodeReasons=ContainerBitrateExceedsLimit"

Anyway, I tried playing around with Yatse again and… well… I can’t reproduce the issue anymore. Which is great - because transcoding works! I tried playing the same movie, at 1M, for 30 seconds. Here’s the jellyfish log:

[2019-12-21 11:13:15.260 -08:00] [INF] User policy for "craig". EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
[2019-12-21 11:13:15.260 -08:00] [INF] Bitrate exceeds DirectPlay limit: media bitrate: 7041275, max bitrate: 1000000
[2019-12-21 11:13:15.260 -08:00] [INF] Bitrate exceeds DirectStream limit: media bitrate: 7041275, max bitrate: 1000000
[2019-12-21 11:13:15.260 -08:00] [INF] Profile: "Unknown Profile", Path: "/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv", isEligibleForDirectPlay: False, isEligibleForDirectStream: False
[2019-12-21 11:13:15.260 -08:00] [INF] RemoteClientBitrateLimit: 10000000, RemoteIp: "192.168.0.3", IsInLocalNetwork: True
[2019-12-21 11:13:15.260 -08:00] [INF] Bitrate exceeds DirectPlay limit: media bitrate: 7041275, max bitrate: 1000000
[2019-12-21 11:13:15.260 -08:00] [INF] Bitrate exceeds DirectStream limit: media bitrate: 7041275, max bitrate: 1000000
[2019-12-21 11:13:15.260 -08:00] [INF] Profile: "Unknown Profile", Path: "/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv", isEligibleForDirectPlay: False, isEligibleForDirectStream: False
[2019-12-21 11:13:15.260 -08:00] [INF] RemoteClientBitrateLimit: 10000000, RemoteIp: "192.168.0.3", IsInLocalNetwork: True
[2019-12-21 11:13:15.260 -08:00] [INF] Bitrate exceeds DirectPlay limit: media bitrate: 7041275, max bitrate: 1000000
[2019-12-21 11:13:15.261 -08:00] [INF] Bitrate exceeds DirectStream limit: media bitrate: 7041275, max bitrate: 1000000
[2019-12-21 11:13:15.261 -08:00] [INF] Profile: "Unknown Profile", Path: "/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv", isEligibleForDirectPlay: False, isEligibleForDirectStream: False
[2019-12-21 11:13:15.836 -08:00] [INF] /usr/lib/jellyfin-ffmpeg/ffmpeg -i file:"/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv" -map 0:0 -map 0:1 -map 0:3 -codec:v:0 h264_nvenc -force_key_frames "expr:gte(t,n_forced*5)" -vf "scale=trunc(min(max(iw\,ih*dar)\,640)/2)*2:trunc(ow/dar/2)*2" -copyts -avoid_negative_ts disabled -start_at_zero -pix_fmt yuv420p -preset default -b:v 616000 -maxrate 616000 -bufsize 1232000 -vsync -1 -map_metadata -1 -map_chapters -1 -threads 0 -codec:a:0 ac3 -ac 6 -ab 384000  -codec:s:0 copy -disposition:s:0 default -y "/config/data/transcoding-temp/transcodes/transcodes/transcodes/90634235d094751070abce670b66392d.mkv"
[2019-12-21 11:13:51.944 -08:00] [INF] Stopping ffmpeg process with q command for "/config/data/transcoding-temp/transcodes/transcodes/transcodes/90634235d094751070abce670b66392d.mkv"
[2019-12-21 11:13:51.955 -08:00] [INF] Playback stopped reported by app "Android" "9" playing "Ad Astra". Stopped at "31" ms
[2019-12-21 11:13:52.067 -08:00] [INF] FFMpeg exited with code 0
[2019-12-21 11:13:52.067 -08:00] [INF] Deleting partial stream file(s) "/config/data/transcoding-temp/transcodes/transcodes/transcodes/90634235d094751070abce670b66392d.mkv"
[2019-12-21 11:13:52.192 -08:00] [INF] Playback stopped reported by app "Android" "9" playing "Ad Astra". Stopped at "31000" ms
[2019-12-21 11:13:52.766 -08:00] [ERR] Error processing request: "The operation was canceled."
[2019-12-21 11:13:52.766 -08:00] [WRN] HTTP Response 200 to "192.168.0.3". Time (slow): 0:00:36.9313548. "http://192.168.0.20:8096/videos/7eca936e-2cd8-7fb2-b7b4-ae69a808b01c/stream.mkv?DeviceId=7b4894ab73e9586a&MediaSourceId=7eca936e2cd87fb2b7b4ae69a808b01c&VideoCodec=h264&AudioCodec=ac3,dts,aac,eac3&AudioStreamIndex=1&SubtitleStreamIndex=3&VideoBitrate=616000&AudioBitrate=384000&PlaySessionId=fd7718c19b1448e49d41b67bfbcdc49b&SubtitleMethod=Embed&TranscodingMaxAudioChannels=6&CopyTimestamps=true&RequireAvc=false&Tag=0e9639f8e0ec8e385c8cae660a30f006&SubtitleCodec=subrip&TranscodeReasons=ContainerBitrateExceedsLimit"
[2019-12-21 11:13:53.567 -08:00] [INF] Playback stopped reported by app "Android" "9" playing "Ad Astra". Stopped at "unknown" ms
[2019-12-21 11:13:53.641 -08:00] [WRN] HTTP Response 204 to "192.168.0.3". Time (slow): 0:00:01.6976872. "http://192.168.0.20:8096/Sessions/Playing/Stopped"
[2019-12-21 11:13:54.074 -08:00] [ERR] Error processing request: "The operation was canceled."
[2019-12-21 11:13:54.074 -08:00] [WRN] HTTP Response 200 to "192.168.0.3". Time (slow): 0:00:36.3912704. "http://192.168.0.20:8096/videos/7eca936e-2cd8-7fb2-b7b4-ae69a808b01c/stream.mkv?DeviceId=7b4894ab73e9586a&MediaSourceId=7eca936e2cd87fb2b7b4ae69a808b01c&VideoCodec=h264&AudioCodec=ac3,dts,aac,eac3&AudioStreamIndex=1&SubtitleStreamIndex=3&VideoBitrate=616000&AudioBitrate=384000&PlaySessionId=fd7718c19b1448e49d41b67bfbcdc49b&SubtitleMethod=Embed&TranscodingMaxAudioChannels=6&CopyTimestamps=true&RequireAvc=false&Tag=0e9639f8e0ec8e385c8cae660a30f006&SubtitleCodec=subrip&TranscodeReasons=ContainerBitrateExceedsLimit"

And here’s the Yatse log:
debug-20191221_111408.zip (31.7 KB)

Do you see anything special in the Yatse log this time other than success?

I’m not sure what changed… because I even had this problem with Yatse going to my Plex server. I haven’t set up hardware-accelerated transcoding on Plex and so I just figured my server was choking on the request. Now, curiously, even Plex is working now!

Nothing changed on Yatse side between the tries :slight_smile: So probably something on the server that prevented ffmepg from working.

Maybe you had a bad update that ended up with broken ffmpeg and it’s now fixed. But the errors where not related to Yatse as Yatse just tells the server what the client support then the server decide to transcode or not and succeed or not.

Yea… here’s the ffmpeg log that came from that failed case. The error is “an undefined constant or missing ‘(’ in ‘mkv’”

http://192.168.0.20:8096/videos/7eca936e-2cd8-7fb2-b7b4-ae69a808b01c/hls1/main/0.mkv?DeviceId=7b4894ab73e9586a&MediaSourceId=7eca936e2cd87fb2b7b4ae69a808b01c&VideoCodec=h264&AudioCodec=ac3,eac3&AudioStreamIndex=1&VideoBitrate=1616000&AudioBitrate=384000&PlaySessionId=8f6be6a6d306492b81eed307bd1fc8e8&api_key=d7c6d4a3a87e4da18a08b6b80a8c0431&TranscodingMaxAudioChannels=6&CopyTimestamps=true&RequireAvc=false&Tag=0e9639f8e0ec8e385c8cae660a30f006&SegmentContainer=mkv&BreakOnNonKeyFrames=False&TranscodeReasons=ContainerBitrateExceedsLimit

{"Protocol":"File","Id":"7eca936e2cd87fb2b7b4ae69a808b01c","Path":"/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv","Type":"Default","Container":"mkv,webm","Size":5907096738,"Name":"Ad Astra (2019) Bluray-1080p","IsRemote":false,"ETag":"0e9639f8e0ec8e385c8cae660a30f006","RunTimeTicks":73824000000,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":true,"VideoType":"VideoFile","MediaStreams":[{"Codec":"h264","TimeBase":"1/1000","CodecTimeBase":"1001/48000","VideoRange":"SDR","DisplayTitle":"1080P H264","NalLengthSize":"4","IsInterlaced":false,"IsAVC":true,"BitRate":6401275,"BitDepth":8,"RefFrames":1,"IsDefault":true,"IsForced":false,"Height":1080,"Width":1920,"AverageFrameRate":23.9760246,"RealFrameRate":23.9760246,"Profile":"High","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":40},{"Codec":"ac3","Language":"eng","TimeBase":"1/1000","CodecTimeBase":"1/48000","Title":"Surround","DisplayTitle":"Eng Dolby Digital 5.1 Default","IsInterlaced":false,"ChannelLayout":"5.1","BitRate":448000,"Channels":6,"SampleRate":48000,"IsDefault":true,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0},{"Codec":"ac3","Language":"eng","TimeBase":"1/1000","CodecTimeBase":"1/48000","Title":"Stereo commentary","DisplayTitle":"Eng Dolby Digital stereo","IsInterlaced":false,"ChannelLayout":"stereo","BitRate":192000,"Channels":2,"SampleRate":48000,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":2,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0},{"Codec":"subrip","Language":"eng","TimeBase":"1/1000","CodecTimeBase":"0/1","localizedUndefined":"Undefined","localizedDefault":"Default","localizedForced":"Forced","DisplayTitle":"Eng - Default","IsInterlaced":false,"IsDefault":true,"IsForced":false,"Type":"Subtitle","Index":3,"IsExternal":false,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Level":0}],"Formats":[],"Bitrate":7041275,"RequiredHttpHeaders":{}}

/usr/lib/jellyfin-ffmpeg/ffmpeg -i file:"/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_nvenc -pix_fmt yuv420p -preset default -b:v 1616000 -maxrate 1616000 -bufsize 3232000 -force_key_frames:0 "expr:gte(t,0+n_forced*3)" -vf "scale=trunc(min(max(iw\,ih*dar)\,720)/2)*2:trunc(ow/dar/2)*2" -copyts -vsync -1 -codec:a:0 ac3 -ac 6 -ab 384000  -f hls -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -hls_time 3 -individual_header_trailer 0 -hls_segment_type mkv -start_number 0 -hls_segment_filename "/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b145%d.mkv" -hls_playlist_type vod -hls_list_size 0 -y "/config/data/transcoding-temp/transcodes/transcodes/transcodes/b36e931c6b79161ffd0160614492b145.m3u8"


ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --toolchain=hardened --prefix=/usr --target-os=linux --enable-cross-compile --extra-cflags=--static --enable-gpl --enable-static --disable-doc --disable-ffplay --disable-shared --disable-libxcb --disable-sdl2 --disable-xlib --enable-libfontconfig --enable-fontconfig --enable-gmp --enable-gnutls --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzvbi --enable-omx --enable-omx-rpi --enable-version3 --enable-vaapi --enable-vdpau --arch=amd64 --enable-nvenc --enable-nvdec
  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 'file:/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv':
  Metadata:
    title           : Ad.Astra.2019.1080p.BluRay.x264-nikt0
    CREATION_TIME   : 2019-12-13T14:54:07Z
    ENCODER         : Lavf57.7.2
  Duration: 02:03:02.40, start: 0.000000, bitrate: 6401 kb/s
    Chapter #0:0: start 0.000000, end 262.679000
    Metadata:
      title           : Chapter 1
    Chapter #0:1: start 262.679000, end 528.695000
    Metadata:
      title           : Chapter 2
    Chapter #0:2: start 528.695000, end 985.776000
    Metadata:
      title           : Chapter 3
    Chapter #0:3: start 985.776000, end 1353.811000
    Metadata:
      title           : Chapter 4
    Chapter #0:4: start 1353.811000, end 1808.557000
    Metadata:
      title           : Chapter 5
    Chapter #0:5: start 1808.557000, end 2108.273000
    Metadata:
      title           : Chapter 6
    Chapter #0:6: start 2108.273000, end 2433.348000
    Metadata:
      title           : Chapter 7
    Chapter #0:7: start 2433.348000, end 2685.391000
    Metadata:
      title           : Chapter 8
    Chapter #0:8: start 2685.391000, end 2936.809000
    Metadata:
      title           : Chapter 9
    Chapter #0:9: start 2936.809000, end 3231.812000
    Metadata:
      title           : Chapter 10
    Chapter #0:10: start 3231.812000, end 3403.775000
    Metadata:
      title           : Chapter 11
    Chapter #0:11: start 3403.775000, end 3691.980000
    Metadata:
      title           : Chapter 12
    Chapter #0:12: start 3691.980000, end 4043.873000
    Metadata:
      title           : Chapter 13
    Chapter #0:13: start 4043.873000, end 4332.411000
    Metadata:
      title           : Chapter 14
    Chapter #0:14: start 4332.411000, end 4619.115000
    Metadata:
      title           : Chapter 15
    Chapter #0:15: start 4619.115000, end 4895.182000
    Metadata:
      title           : Chapter 16
    Chapter #0:16: start 4895.182000, end 5082.661000
    Metadata:
      title           : Chapter 17
    Chapter #0:17: start 5082.661000, end 5476.554000
    Metadata:
      title           : Chapter 18
    Chapter #0:18: start 5476.554000, end 5787.031000
    Metadata:
      title           : Chapter 19
    Chapter #0:19: start 5787.031000, end 6059.595000
    Metadata:
      title           : Chapter 20
    Chapter #0:20: start 6059.595000, end 6386.672000
    Metadata:
      title           : Chapter 21
    Chapter #0:21: start 6386.672000, end 6600.052000
    Metadata:
      title           : Chapter 22
    Chapter #0:22: start 6600.052000, end 6797.791000
    Metadata:
      title           : Chapter 23
    Chapter #0:23: start 6797.791000, end 7382.334000
    Metadata:
      title           : Chapter 24
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      BPS-eng         : 5759095
      DURATION-eng    : 02:03:02.375000000
      NUMBER_OF_FRAMES-eng: 177000
      NUMBER_OF_BYTES-eng: 5314475127
      _STATISTICS_WRITING_APP-eng: mkvmerge v38.0.0 ('The Silent Type') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-12-15 08:45:20
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      title           : Surround
      BPS-eng         : 448000
      DURATION-eng    : 02:03:02.368000000
      NUMBER_OF_FRAMES-eng: 230699
      NUMBER_OF_BYTES-eng: 413412608
      _STATISTICS_WRITING_APP-eng: mkvmerge v38.0.0 ('The Silent Type') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-12-15 08:45:20
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : Stereo commentary
      BPS-eng         : 192000
      DURATION-eng    : 02:03:02.400000000
      NUMBER_OF_FRAMES-eng: 230700
      NUMBER_OF_BYTES-eng: 177177600
      _STATISTICS_WRITING_APP-eng: mkvmerge v38.0.0 ('The Silent Type') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-12-15 08:45:20
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(eng): Subtitle: subrip (default)
    Metadata:
      BPS-eng         : 57
      DURATION-eng    : 01:50:49.427000000
      NUMBER_OF_FRAMES-eng: 1393
      NUMBER_OF_BYTES-eng: 48054
      _STATISTICS_WRITING_APP-eng: mkvmerge v38.0.0 ('The Silent Type') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-12-15 08:45:20
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (ac3 (native) -> ac3 (native))
Press [q] to stop, [?] for help
[hls muxer @ 0x55b4d0bde280] [Eval @ 0x7ffdb0197cc0] Undefined constant or missing '(' in 'mkv'
[hls muxer @ 0x55b4d0bde280] Unable to parse option value "mkv"
[hls muxer @ 0x55b4d0bde280] Error setting option hls_segment_type to value mkv.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 -- 
Conversion failed!

Here’s the same file working:

http://192.168.0.20:8096/videos/7eca936e-2cd8-7fb2-b7b4-ae69a808b01c/stream.mkv?DeviceId=7b4894ab73e9586a&MediaSourceId=7eca936e2cd87fb2b7b4ae69a808b01c&VideoCodec=h264&AudioCodec=ac3,dts,aac,eac3&AudioStreamIndex=1&SubtitleStreamIndex=3&VideoBitrate=616000&AudioBitrate=384000&PlaySessionId=fd7718c19b1448e49d41b67bfbcdc49b&api_key=d7c6d4a3a87e4da18a08b6b80a8c0431&SubtitleMethod=Embed&TranscodingMaxAudioChannels=6&CopyTimestamps=true&RequireAvc=false&Tag=0e9639f8e0ec8e385c8cae660a30f006&SubtitleCodec=subrip&TranscodeReasons=ContainerBitrateExceedsLimit

{"Protocol":"File","Id":"7eca936e2cd87fb2b7b4ae69a808b01c","Path":"/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv","Type":"Default","Container":"mkv,webm","Size":5907096738,"Name":"Ad Astra (2019) Bluray-1080p","IsRemote":false,"ETag":"0e9639f8e0ec8e385c8cae660a30f006","RunTimeTicks":73824000000,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":true,"VideoType":"VideoFile","MediaStreams":[{"Codec":"h264","TimeBase":"1/1000","CodecTimeBase":"1001/48000","VideoRange":"SDR","DisplayTitle":"1080P H264","NalLengthSize":"4","IsInterlaced":false,"IsAVC":true,"BitRate":6401275,"BitDepth":8,"RefFrames":1,"IsDefault":true,"IsForced":false,"Height":1080,"Width":1920,"AverageFrameRate":23.9760246,"RealFrameRate":23.9760246,"Profile":"High","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":40},{"Codec":"ac3","Language":"eng","TimeBase":"1/1000","CodecTimeBase":"1/48000","Title":"Surround","DisplayTitle":"Eng Dolby Digital 5.1 Default","IsInterlaced":false,"ChannelLayout":"5.1","BitRate":448000,"Channels":6,"SampleRate":48000,"IsDefault":true,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0},{"Codec":"ac3","Language":"eng","TimeBase":"1/1000","CodecTimeBase":"1/48000","Title":"Stereo commentary","DisplayTitle":"Eng Dolby Digital stereo","IsInterlaced":false,"ChannelLayout":"stereo","BitRate":192000,"Channels":2,"SampleRate":48000,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":2,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0},{"Codec":"subrip","Language":"eng","TimeBase":"1/1000","CodecTimeBase":"0/1","localizedUndefined":"Undefined","localizedDefault":"Default","localizedForced":"Forced","DisplayTitle":"Eng - Default","IsInterlaced":false,"IsDefault":true,"IsForced":false,"Type":"Subtitle","Index":3,"IsExternal":false,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Level":0}],"Formats":[],"Bitrate":7041275,"RequiredHttpHeaders":{}}

/usr/lib/jellyfin-ffmpeg/ffmpeg -i file:"/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv" -map 0:0 -map 0:1 -map 0:3 -codec:v:0 h264_nvenc -force_key_frames "expr:gte(t,n_forced*5)" -vf "scale=trunc(min(max(iw\,ih*dar)\,640)/2)*2:trunc(ow/dar/2)*2" -copyts -avoid_negative_ts disabled -start_at_zero -pix_fmt yuv420p -preset default -b:v 616000 -maxrate 616000 -bufsize 1232000 -vsync -1 -map_metadata -1 -map_chapters -1 -threads 0 -codec:a:0 ac3 -ac 6 -ab 384000  -codec:s:0 copy -disposition:s:0 default -y "/config/data/transcoding-temp/transcodes/transcodes/transcodes/90634235d094751070abce670b66392d.mkv"


ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --toolchain=hardened --prefix=/usr --target-os=linux --enable-cross-compile --extra-cflags=--static --enable-gpl --enable-static --disable-doc --disable-ffplay --disable-shared --disable-libxcb --disable-sdl2 --disable-xlib --enable-libfontconfig --enable-fontconfig --enable-gmp --enable-gnutls --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzvbi --enable-omx --enable-omx-rpi --enable-version3 --enable-vaapi --enable-vdpau --arch=amd64 --enable-nvenc --enable-nvdec
  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 'file:/movies/Ad Astra (2019)/Ad Astra (2019) Bluray-1080p.mkv':
  Metadata:
    title           : Ad.Astra.2019.1080p.BluRay.x264-nikt0
    CREATION_TIME   : 2019-12-13T14:54:07Z
    ENCODER         : Lavf57.7.2
  Duration: 02:03:02.40, start: 0.000000, bitrate: 6401 kb/s
    Chapter #0:0: start 0.000000, end 262.679000
    Metadata:
      title           : Chapter 1
    Chapter #0:1: start 262.679000, end 528.695000
    Metadata:
      title           : Chapter 2
    Chapter #0:2: start 528.695000, end 985.776000
    Metadata:
      title           : Chapter 3
    Chapter #0:3: start 985.776000, end 1353.811000
    Metadata:
      title           : Chapter 4
    Chapter #0:4: start 1353.811000, end 1808.557000
    Metadata:
      title           : Chapter 5
    Chapter #0:5: start 1808.557000, end 2108.273000
    Metadata:
      title           : Chapter 6
    Chapter #0:6: start 2108.273000, end 2433.348000
    Metadata:
      title           : Chapter 7
    Chapter #0:7: start 2433.348000, end 2685.391000
    Metadata:
      title           : Chapter 8
    Chapter #0:8: start 2685.391000, end 2936.809000
    Metadata:
      title           : Chapter 9
    Chapter #0:9: start 2936.809000, end 3231.812000
    Metadata:
      title           : Chapter 10
    Chapter #0:10: start 3231.812000, end 3403.775000
    Metadata:
      title           : Chapter 11
    Chapter #0:11: start 3403.775000, end 3691.980000
    Metadata:
      title           : Chapter 12
    Chapter #0:12: start 3691.980000, end 4043.873000
    Metadata:
      title           : Chapter 13
    Chapter #0:13: start 4043.873000, end 4332.411000
    Metadata:
      title           : Chapter 14
    Chapter #0:14: start 4332.411000, end 4619.115000
    Metadata:
      title           : Chapter 15
    Chapter #0:15: start 4619.115000, end 4895.182000
    Metadata:
      title           : Chapter 16
    Chapter #0:16: start 4895.182000, end 5082.661000
    Metadata:
      title           : Chapter 17
    Chapter #0:17: start 5082.661000, end 5476.554000
    Metadata:
      title           : Chapter 18
    Chapter #0:18: start 5476.554000, end 5787.031000
    Metadata:
      title           : Chapter 19
    Chapter #0:19: start 5787.031000, end 6059.595000
    Metadata:
      title           : Chapter 20
    Chapter #0:20: start 6059.595000, end 6386.672000
    Metadata:
      title           : Chapter 21
    Chapter #0:21: start 6386.672000, end 6600.052000
    Metadata:
      title           : Chapter 22
    Chapter #0:22: start 6600.052000, end 6797.791000
    Metadata:
      title           : Chapter 23
    Chapter #0:23: start 6797.791000, end 7382.334000
    Metadata:
      title           : Chapter 24
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      BPS-eng         : 5759095
      DURATION-eng    : 02:03:02.375000000
      NUMBER_OF_FRAMES-eng: 177000
      NUMBER_OF_BYTES-eng: 5314475127
      _STATISTICS_WRITING_APP-eng: mkvmerge v38.0.0 ('The Silent Type') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-12-15 08:45:20
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      title           : Surround
      BPS-eng         : 448000
      DURATION-eng    : 02:03:02.368000000
      NUMBER_OF_FRAMES-eng: 230699
      NUMBER_OF_BYTES-eng: 413412608
      _STATISTICS_WRITING_APP-eng: mkvmerge v38.0.0 ('The Silent Type') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-12-15 08:45:20
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : Stereo commentary
      BPS-eng         : 192000
      DURATION-eng    : 02:03:02.400000000
      NUMBER_OF_FRAMES-eng: 230700
      NUMBER_OF_BYTES-eng: 177177600
      _STATISTICS_WRITING_APP-eng: mkvmerge v38.0.0 ('The Silent Type') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-12-15 08:45:20
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(eng): Subtitle: subrip (default)
    Metadata:
      BPS-eng         : 57
      DURATION-eng    : 01:50:49.427000000
      NUMBER_OF_FRAMES-eng: 1393
      NUMBER_OF_BYTES-eng: 48054
      _STATISTICS_WRITING_APP-eng: mkvmerge v38.0.0 ('The Silent Type') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-12-15 08:45:20
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (ac3 (native) -> ac3 (native))
  Stream #0:3 -> #0:2 (copy)
Press [q] to stop, [?] for help
Output #0, matroska, to '/config/data/transcoding-temp/transcodes/transcodes/transcodes/90634235d094751070abce670b66392d.mkv':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (h264_nvenc) (Main) (H264 / 0x34363248), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 616 kb/s, 23.98 fps, 1k tbn, 23.98 tbc (default)
    Metadata:
      encoder         : Lavc58.54.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 616000/0/616000 buffer size: 1232000 vbv_delay: -1
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1, fltp, 384 kb/s (default)
    Metadata:
      encoder         : Lavc58.54.100 ac3
    Stream #0:2: Subtitle: subrip (default)
frame=   48 fps=0.0 q=20.0 size=       1kB time=00:00:02.33 bitrate=   3.5kbits/s speed=4.66x    
frame=  185 fps=184 q=28.0 size=       1kB time=00:00:08.05 bitrate=   1.0kbits/s speed=8.03x    
frame=  322 fps=214 q=25.0 size=       1kB time=00:00:13.81 bitrate=   0.6kbits/s speed=9.19x    
frame=  462 fps=230 q=14.0 size=     571kB time=00:00:19.57 bitrate= 238.9kbits/s speed=9.76x    
frame=  613 fps=244 q=12.0 size=    1824kB time=00:00:25.78 bitrate= 579.5kbits/s speed=10.3x    
frame=  734 fps=244 q=22.0 size=    2422kB time=00:00:31.00 bitrate= 640.0kbits/s speed=10.3x    
frame=  867 fps=247 q=13.0 size=    2792kB time=00:00:36.53 bitrate= 626.0kbits/s speed=10.4x    
frame= 1002 fps=250 q=12.0 size=    3397kB time=00:00:42.23 bitrate= 658.9kbits/s speed=10.5x    
frame= 1170 fps=259 q=12.0 size=    3890kB time=00:00:49.11 bitrate= 648.9kbits/s speed=10.9x    
frame= 1324 fps=264 q=12.0 size=    4339kB time=00:00:55.41 bitrate= 641.3kbits/s speed=11.1x    
frame= 1450 fps=263 q=13.0 size=    4609kB time=00:01:00.73 bitrate= 621.8kbits/s speed=  11x    
frame= 1572 fps=261 q=13.0 size=    4888kB time=00:01:05.88 bitrate= 607.8kbits/s speed=10.9x    
frame= 1689 fps=259 q=13.0 size=    5183kB time=00:01:10.68 bitrate= 600.8kbits/s speed=10.8x    
frame= 1810 fps=258 q=13.0 size=    5614kB time=00:01:15.73 bitrate= 607.2kbits/s speed=10.8x    
frame= 1933 fps=257 q=13.0 size=    6076kB time=00:01:20.95 bitrate= 614.9kbits/s speed=10.7x    
frame= 2055 fps=256 q=12.0 size=    6548kB time=00:01:26.01 bitrate= 623.7kbits/s speed=10.7x    
frame= 2158 fps=253 q=12.0 size=    6863kB time=00:01:30.42 bitrate= 621.7kbits/s speed=10.6x    
frame= 2271 fps=251 q=13.0 size=    7331kB time=00:01:34.97 bitrate= 632.3kbits/s speed=10.5x    
frame= 2387 fps=250 q=16.0 size=    7871kB time=00:01:39.86 bitrate= 645.7kbits/s speed=10.5x    
frame= 2473 fps=246 q=15.0 size=    8417kB time=00:01:43.51 bitrate= 666.1kbits/s speed=10.3x    
frame= 2579 fps=244 q=18.0 size=    8463kB time=00:01:47.86 bitrate= 642.7kbits/s speed=10.2x    
frame= 2687 fps=243 q=16.0 size=    9082kB time=00:01:52.34 bitrate= 662.2kbits/s speed=10.2x    
frame= 2805 fps=243 q=16.0 size=    9761kB time=00:01:57.43 bitrate= 680.9kbits/s speed=10.2x    
frame= 2949 fps=245 q=14.0 size=   10366kB time=00:02:03.19 bitrate= 689.3kbits/s speed=10.2x    
frame= 3094 fps=246 q=17.0 size=   11035kB time=00:02:09.40 bitrate= 698.6kbits/s speed=10.3x    
frame= 3228 fps=247 q=20.0 size=   12239kB time=00:02:15.13 bitrate= 741.9kbits/s speed=10.3x    
frame= 3359 fps=248 q=23.0 size=   12927kB time=00:02:20.44 bitrate= 754.0kbits/s speed=10.4x    
frame= 3485 fps=248 q=31.0 size=   13583kB time=00:02:25.62 bitrate= 764.1kbits/s speed=10.4x    
frame= 3599 fps=247 q=32.0 size=   13583kB time=00:02:30.33 bitrate= 740.2kbits/s speed=10.3x    
frame= 3751 fps=249 q=13.0 size=   15525kB time=00:02:36.66 bitrate= 811.8kbits/s speed=10.4x    
frame= 3907 fps=251 q=14.0 size=   16641kB time=00:02:43.22 bitrate= 835.2kbits/s speed=10.5x    
frame= 4064 fps=253 q=26.0 size=   17225kB time=00:02:49.78 bitrate= 831.1kbits/s speed=10.6x    
frame= 4207 fps=254 q=13.0 size=   17857kB time=00:02:55.93 bitrate= 831.5kbits/s speed=10.6x    
frame= 4335 fps=254 q=16.0 size=   18463kB time=00:03:01.33 bitrate= 834.1kbits/s speed=10.6x    
frame= 4464 fps=254 q=16.0 size=   19059kB time=00:03:06.81 bitrate= 835.8kbits/s speed=10.6x    
frame= 4577 fps=253 q=15.0 size=   19730kB time=00:03:11.13 bitrate= 845.6kbits/s speed=10.6x    
frame= 4689 fps=253 q=14.0 size=   19730kB time=00:03:15.93 bitrate= 824.9kbits/s speed=10.6x    
frame= 4826 fps=253 q=13.0 size=   20948kB time=00:03:21.69 bitrate= 850.8kbits/s speed=10.6x    
frame= 4985 fps=255 q=17.0 size=   21510kB time=00:03:28.31 bitrate= 845.9kbits/s speed=10.6x    
frame= 5141 fps=256 q=14.0 size=   22705kB time=00:03:34.61 bitrate= 866.6kbits/s speed=10.7x    
frame= 5295 fps=257 q=12.0 size=   23246kB time=00:03:41.14 bitrate= 861.1kbits/s speed=10.8x    
frame= 5442 fps=258 q=23.0 size=   23746kB time=00:03:47.29 bitrate= 855.8kbits/s speed=10.8x    
frame= 5589 fps=259 q=19.0 size=   23746kB time=00:03:53.49 bitrate= 833.1kbits/s speed=10.8x    
frame= 5720 fps=259 q=21.0 size=   25030kB time=00:03:58.93 bitrate= 858.1kbits/s speed=10.8x    
frame= 5819 fps=258 q=25.0 size=   25712kB time=00:04:03.13 bitrate= 866.3kbits/s speed=10.8x    
frame= 5926 fps=257 q=19.0 size=   26319kB time=00:04:07.48 bitrate= 871.2kbits/s speed=10.7x    
frame= 6034 fps=256 q=23.0 size=   26928kB time=00:04:11.93 bitrate= 875.6kbits/s speed=10.7x    
frame= 6123 fps=254 q=22.0 size=   26928kB time=00:04:15.70 bitrate= 862.7kbits/s speed=10.6x    
frame= 6204 fps=252 q=20.0 size=   27592kB time=00:04:18.97 bitrate= 872.8kbits/s speed=10.5x    
frame= 6276 fps=250 q=15.0 size=   27592kB time=00:04:22.13 bitrate= 862.3kbits/s speed=10.4x    
frame= 6368 fps=249 q=20.0 size=   27592kB time=00:04:25.85 bitrate= 850.2kbits/s speed=10.4x    
frame= 6460 fps=247 q=23.0 size=   28883kB time=00:04:29.78 bitrate= 877.0kbits/s speed=10.3x    
frame= 6547 fps=246 q=24.0 size=   29543kB time=00:04:33.40 bitrate= 885.2kbits/s speed=10.3x    
frame= 6640 fps=245 q=22.0 size=   30147kB time=00:04:37.21 bitrate= 890.9kbits/s speed=10.2x    
frame= 6712 fps=243 q=30.0 size=   30147kB time=00:04:40.28 bitrate= 881.1kbits/s speed=10.2x    
frame= 6787 fps=241 q=29.0 size=   30147kB time=00:04:43.48 bitrate= 871.2kbits/s speed=10.1x    
frame= 6885 fps=241 q=26.0 size=   30862kB time=00:04:47.35 bitrate= 879.8kbits/s speed=  10x    
frame= 6986 fps=240 q=27.0 size=   31429kB time=00:04:51.80 bitrate= 882.3kbits/s speed=  10x    
frame= 7081 fps=239 q=31.0 size=   32091kB time=00:04:55.67 bitrate= 889.1kbits/s speed=9.98x    
frame= 7197 fps=239 q=34.0 size=   32091kB time=00:05:00.47 bitrate= 874.9kbits/s speed=9.98x    
frame= 7312 fps=239 q=32.0 size=   32091kB time=00:05:05.21 bitrate= 861.3kbits/s speed=9.97x    
frame= 7439 fps=239 q=33.0 size=   34011kB time=00:05:10.68 bitrate= 896.8kbits/s speed=9.98x    
frame= 7570 fps=239 q=24.0 size=   34648kB time=00:05:16.18 bitrate= 897.7kbits/s speed=  10x    
frame= 7696 fps=240 q=30.0 size=   35259kB time=00:05:21.24 bitrate= 899.1kbits/s speed=  10x    
frame= 7813 fps=239 q=34.0 size=   35956kB time=00:05:26.23 bitrate= 902.9kbits/s speed=  10x    
frame= 7948 fps=240 q=24.0 size=   35956kB time=00:05:31.73 bitrate= 887.9kbits/s speed=  10x    
frame= 8072 fps=240 q=28.0 size=   37207kB time=00:05:36.89 bitrate= 904.7kbits/s speed=  10x    
frame= 8175 fps=240 q=33.0 size=   37811kB time=00:05:41.33 bitrate= 907.4kbits/s speed=  10x    
frame= 8285 fps=239 q=28.0 size=   37811kB time=00:05:45.85 bitrate= 895.6kbits/s speed=9.99x    
frame= 8418 fps=240 q=31.0 size=   39091kB time=00:05:51.38 bitrate= 911.3kbits/s speed=  10x    
frame= 8540 fps=240 q=30.0 size=   39758kB time=00:05:56.37 bitrate= 913.9kbits/s speed=  10x    
frame= 8638 fps=240 q=26.0 Lsize=   40476kB time=00:06:00.66 bitrate= 919.3kbits/s speed=  10x    
video:23425kB audio:16906kB subtitle:2kB other streams:0kB global headers:0kB muxing overhead: 0.351046%

I’m no expert here, but the command line changed a fair amount and there was an extra “stream” in the passing case (#0:3). ¯_(ツ)_/¯. Well… i guess we consider this solved :wink:. In case I come across this again should I post again here?

Also, darn curious, how is it that Yatse can stream and sync Plex video, without the limitations the Plex for Android app imposes? I guess its just obvious that you’ve made your own app… but its really such a super nice feature and a delightful surprise as I’m exploring Plex and found I can get all the benefits of Plex (that I care about) with my already unlocked Yatse app. Kudos!

Your options are not the same in one case you say you support dts/aac and not in the other case, so the server does not transcode in the same way since the needs are not the same.

And since Plex allow access to transcoding and media without plex pass then anyone can reproduce most functions related to those.

Hi! I’m back! And the issue is back!

Alright, so here’s a debug log of Yatse with me playing a video with all 4 audio codecs supported and maximum bitrate requested to my jellyfin server, but it just hangs there in MX player.

debug-20191222_172335.zip (29.0 KB)

I also tried playing the same file from my phone’s webbrowser. Agreeably, the settings might be a bit different there, but it worked from the webbrowser, just not from the Yatse App. Here’s the two ffmpeg commands it used. The first one was generated from Yatse trying to play the file. The second one was generated from the web browser trying to play the file. I added some spaces to help improve the readability.

/usr/lib/jellyfin-ffmpeg/ffmpeg -ss 00:00:15.000 -noaccurate_seek -i file:"/movies/Toy Story 3 (2010)/Toy Story 3 (2010) Bluray-1080p.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_nvenc -pix_fmt yuv420p -preset default -b:v 6733738 -maxrate 6733738 -bufsize 13467476                 -force_key_frames:0 "expr:gte(t,15+n_forced*3)" -vf "scale=trunc(min(max(iw\,ih*dar)\,1920)/2)*2:trunc(ow/dar/2)*2" -copyts -vsync -1 -codec:a:0 ac3        -ac 6 -ab 384000                -f hls -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -hls_time 3 -individual_header_trailer 0 -hls_segment_type mkv    -start_number 5 -hls_segment_filename "/config/data/transcoding-temp/transcodes/transcodes/transcodes/transcodes/transcodes/d8e3cfad133283a5e3ce227aba05acd8%d.mkv" -hls_playlist_type vod -hls_list_size 0 -y "/config/data/transcoding-temp/transcodes/transcodes/transcodes/transcodes/transcodes/d8e3cfad133283a5e3ce227aba05acd8.m3u8"
/usr/lib/jellyfin-ffmpeg/ffmpeg                                   -i file:"/movies/Toy Story 3 (2010)/Toy Story 3 (2010) Bluray-1080p.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_nvenc -pix_fmt yuv420p -preset default -b:v 5460218 -maxrate 5460218 -bufsize 10920436 -profile:v high -force_key_frames:0 "expr:gte(t,0+n_forced*3)"  -vf "scale=trunc(min(max(iw\,ih*dar)\,1920)/2)*2:trunc(ow/dar/2)*2" -copyts -vsync -1 -codec:a:0 libmp3lame -ac 2 -ab 384000 -af "volume=2" -f hls -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -hls_time 3 -individual_header_trailer 0 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/config/data/transcoding-temp/transcodes/transcodes/transcodes/transcodes/transcodes/412a22a3760a4f3a4a019ce29cb78a8d%d.ts"  -hls_playlist_type vod -hls_list_size 0 -y "/config/data/transcoding-temp/transcodes/transcodes/transcodes/transcodes/transcodes/412a22a3760a4f3a4a019ce29cb78a8d.m3u8"

ffmpeg_yatse.txt (11.2 KB) ffmpeg_browser.txt (38.1 KB)

And finally, here’s the jellyfin log containing both attempts to play the same movie.

jellyfin.txt (34.4 KB)

What stands out for me, in the case of Yatse, it’s trying to use -hls_segment_type mkv, whereas the browser is trying to use mpegts. I pulled up the ffmpeg documentation, and it doesn’t actually list mkv as an appropriate value (only mpegts and fmp4). I also notice the input file is an mkv also - i might try to see if things are different if I play a different file.

Anyway, this is possibly not the fault at all of Yatse by the way things are going, but Its definitely helpful to have a place to collect my thoughts and have you sanity checking. Can you think of any reason why jellyfin would be requesting an MKV via Yatse?

Well as I said this is Jellyfin that decide how to transcode the media I do not directly control the ffmepg call.

  1. Yatse ask Jellyfin the transcoding url for the said media with a device profile that contains the information about the codecs / format that the device support. (This is what change when you change Yatse settings)

2019-12-22 17:22:46.280 Verbose/EmbyLogger: --> [368] POST https://roundboijellyfin.duckdns.org/Items/0e94256a00b54e9d391ea94c83207ba8/PlaybackInfo?UserId=539249ddab254b99b8ea5c055030f29b&AutoOpenLiveStream=true&StartTimeTicks=0&MaxStreamingBitrate=140000000 (1426-byte body)
2019-12-22 17:22:46.280 Verbose/EmbyLogger: --> [368] {“deviceProfile”:{“CodecProfiles”:[{“Conditions”:[{“Condition”:“Equals”,“IsRequired”:“false”,“Property”:“IsSecondaryAudio”,“Value”:“false”}],“Type”:“VideoAudio”}],“DirectPlayProfiles”:[{“Container”:"",“Type”:“Video”,“VideoCodec”:“ac3,dts,aac,eac3”},{“Container”:"",“Type”:“Audio”},{“Container”:"",“Type”:“Photo”}],“MaxStaticBitrate”:100000000,“MaxStreamingBitrate”:120000000,“MusicStreamingTranscodingBitrate”:192000,“ResponseProfiles”:[{“Container”:“m4v”,“MimeType”:“video/mp4”,“Type”:“Video”},{“Container”:“mov”,“MimeType”:“video/webm”,“Type”:“Video”}],“SubtitleProfiles”:[{“Format”:“vtt”,“Method”:“Embed”},{“Format”:“srt”,“Method”:“Embed”},{“Format”:“ass”,“Method”:“Embed”},{“Format”:“ssa”,“Method”:“Embed”},{“Format”:“smi”,“Method”:“Embed”},{“Format”:“subrip”,“Method”:“Embed”},{“Format”:“sub”,“Method”:“Embed”},{“Format”:“dvdsub”,“Method”:“Embed”},{“Format”:“pgs”,“Method”:“Embed”},{“Format”:“pgssub”,“Method”:“Embed”},{“Format”:“srt”,“Method”:“External”},{“Format”:“sub”,“Method”:“External”}],“TranscodingProfiles”:[{“AudioCodec”:“ac3,dts,aac,eac3”,“Container”:“mkv”,“Context”:“Streaming”,“CopyTimestamps”:true,“MaxAudioChannels”:“6”,“Protocol”:“hls”,“Type”:“Video”,“VideoCodec”:“h264”},{“AudioCodec”:“mp3”,“Container”:“mp3”,“Context”:“Static”,“MaxAudioChannels”:“6”,“Protocol”:“http”,“Type”:“Audio”},{“AudioCodec”:“mp3”,“Container”:“mp3”,“Context”:“Streaming”,“MaxAudioChannels”:“6”,“Protocol”:“http”,“Type”:“Audio”}]}}

  1. Jellyfin answers with a transcoding url that is supposed to be optimized for those params.

2019-12-22 17:22:46.451 Verbose/EmbyLogger: <-- [368] {“MediaSources”:[{“Protocol”:“File”,“Id”:“0e94256a00b54e9d391ea94c83207ba8”,“Path”:"/movies/The Fall (2008)/The Fall (2008).avi",“Type”:“Default”,“Container”:“avi”,“Size”:735201280,“Name”:“The Fall (2008)”,“IsRemote”:false,“ETag”:“70e95ab057d25cce0752b84db6148cbe”,“RunTimeTicks”:70272360448,“ReadAtNativeFramerate”:false,“IgnoreDts”:false,“IgnoreIndex”:false,“GenPtsInput”:false,“SupportsTranscoding”:true,“SupportsDirectStream”:false,“SupportsDirectPlay”:false,“IsInfiniteStream”:false,“RequiresOpening”:false,“RequiresClosing”:false,“RequiresLooping”:false,“SupportsProbing”:true,“VideoType”:“VideoFile”,“MediaStreams”:[{“Codec”:“mpeg4”,“CodecTag”:“XVID”,“TimeBase”:“125/2997”,“CodecTimeBase”:“125/2997”,“VideoRange”:“SDR”,“DisplayTitle”:“SD MPEG4”,“IsInterlaced”:false,“BitRate”:715665,“RefFrames”:1,“IsDefault”:false,“IsForced”:false,“Height”:308,“Width”:584,“AverageFrameRate”:23.976,“RealFrameRate”:23.976,“Profile”:“Advanced Simple Profile”,“Type”:“Video”,“AspectRatio”:“146:77”,“Index”:0,“IsExternal”:false,“IsTextSubtitleStream”:false,“SupportsExternalStream”:false,“PixelFormat”:“yuv420p”,“Level”:5},{“Codec”:“mp3”,“TimeBase”:“3/125”,“CodecTimeBase”:“1/48000”,“DisplayTitle”:“MP3 stereo”,“IsInterlaced”:false,“ChannelLayout”:“stereo”,“BitRate”:112000,“Channels”:2,“SampleRate”:48000,“IsDefault”:false,“IsForced”:false,“Type”:“Audio”,“Index”:1,“IsExternal”:false,“IsTextSubtitleStream”:false,“SupportsExternalStream”:false,“Level”:0}],“Formats”:[],“Bitrate”:836973,“RequiredHttpHeaders”:{},“TranscodingUrl”:"/videos/0e94256a-00b5-4e9d-391e-a94c83207ba8/master.m3u8?DeviceId=7b4894ab73e9586a&MediaSourceId=0e94256a00b54e9d391ea94c83207ba8&VideoCodec=h264&AudioCodec=ac3,dts,aac,eac3&AudioStreamIndex=1&VideoBitrate=9888000&AudioBitrate=112000&PlaySessionId=b432338b8b0c42b9b2c59961209418e6&api_key=d7c6d4a3a87e4da18a08b6b80a8c0431&TranscodingMaxAudioChannels=6&CopyTimestamps=true&RequireAvc=false&Tag=70e95ab057d25cce0752b84db6148cbe&SegmentContainer=mkv&BreakOnNonKeyFrames=False",“TranscodingSubProtocol”:“hls”,“TranscodingContainer”:“mkv”,“DefaultAudioStreamIndex”:1}],“PlaySessionId”:“b432338b8b0c42b9b2c59961209418e6”}

  1. Yatse plays that URL

2019-12-22 17:22:46.572 Verbose/StreamActivity: [email protected]: Starting media: https://roundboijellyfin.duckdns.org:443/videos/0e94256a-00b5-4e9d-391e-a94c83207ba8/master.m3u8?DeviceId=7b4894ab73e9586a&MediaSourceId=0e94256a00b54e9d391ea94c83207ba8&VideoCodec=h264&AudioCodec=ac3,dts,aac,eac3&AudioStreamIndex=1&VideoBitrate=9888000&AudioBitrate=112000&PlaySessionId=b432338b8b0c42b9b2c59961209418e6&api_key=d7c6d4a3a87e4da18a08b6b80a8c0431&TranscodingMaxAudioChannels=6&CopyTimestamps=true&RequireAvc=false&Tag=70e95ab057d25cce0752b84db6148cbe&SegmentContainer=mkv&BreakOnNonKeyFrames=False - [email protected]

To better understand that request Yatse sends, I tried to make it a bit more human-readable. Some things that jump out are: “VideoCodec”:“ac3,dts,aac,eac3” within DirectPlayProfiles and “Protocol”:“hls” within TranscodingProfiles.

[368] 
{
	“deviceProfile”:
	{
		“CodecProfiles”:
		[
			{
				“Conditions”:
				[
					{
						“Condition”:“Equals”,
						“IsRequired”:“false”,
						“Property”:“IsSecondaryAudio”,
						“Value”:“false”
					}
				],
				“Type”:“VideoAudio”
			}
		],
		“DirectPlayProfiles”:
		[
			{
				“Container”:"",
				“Type”:“Video”,
				“VideoCodec”:“ac3,dts,aac,eac3”
			},
			{
				“Container”:"",
				“Type”:“Audio”
			},
			{
				“Container”:"",
				“Type”:“Photo”
			}
		],
		“MaxStaticBitrate”:100000000,
		“MaxStreamingBitrate”:120000000,
		“MusicStreamingTranscodingBitrate”:192000,
		“ResponseProfiles”:
		[
			{
				“Container”:“m4v”,
				“MimeType”:“video/mp4”,
				“Type”:“Video”
			},
			{
				“Container”:“mov”,
				“MimeType”:“video/webm”,
				“Type”:“Video”
			}
		],
		“SubtitleProfiles”:
		[
			{
				“Format”:“vtt”,
				“Method”:“Embed”
			},
			{
				“Format”:“srt”,
				“Method”:“Embed”
			},
			{
				“Format”:“ass”,
				“Method”:“Embed”
			},
			{
				“Format”:“ssa”,
				“Method”:“Embed”
			},
			{
				“Format”:“smi”,
				“Method”:“Embed”
			},
			{
				“Format”:“subrip”,
				“Method”:“Embed”
			},
			{
				“Format”:“sub”,
				“Method”:“Embed”
			},
			{
				“Format”:“dvdsub”,
				“Method”:“Embed”
			},
			{
				“Format”:“pgs”,
				“Method”:“Embed”
			},
			{
				“Format”:“pgssub”,
				“Method”:“Embed”
			},
			{
				“Format”:“srt”,
				“Method”:“External”
			},
			{
				“Format”:“sub”,
				“Method”:“External”
			}
		],
		“TranscodingProfiles”:
		[
			{
				“AudioCodec”:“ac3,dts,aac,eac3”,
				“Container”:“mkv”,
				“Context”:“Streaming”,
				“CopyTimestamps”:true,
				“MaxAudioChannels”:“6”,
				“Protocol”:“hls”,
				“Type”:“Video”,
				“VideoCodec”:“h264”
			},
			{
				“AudioCodec”:“mp3”,
				“Container”:“mp3”,
				“Context”:“Static”,
				“MaxAudioChannels”:“6”,
				“Protocol”:“http”,
				“Type”:“Audio”
			},
			{
				“AudioCodec”:“mp3”,
				“Container”:“mp3”,
				“Context”:“Streaming”,
				“MaxAudioChannels”:“6”,
				“Protocol”:“http”,
				“Type”:“Audio”
			}
		]
	}
}

Where’s the spec on what these are supposed to look like? I found the following “examples” on the jellyfin codebase. Is it possible that you’re not supposed to send Protocol hls?

Here’s one that specifically has an mkv listed in the TranscodeProfile, though it doesn’t talk about hls at all. I also tried searching the code for hls and perhaps it’s a “TranscodingSubProtocol”.

My justification for picking on hls is that I don’t think ffmpeg (as an example implementation) supports hls and mkv together. https://ffmpeg.org/ffmpeg-formats.html.

The video codec was a typo but does not really impact here as it’s for direct play that already properly works.

The profiles are taken from Emby clients, have not changed in Yatse since the start and there’s plenty of users using it without any issue.

There was maybe a recent ffmepg / jellyfin update that interpret the profile differently but for the moment no other report than you and it still works here with Emby so it’s a little strange.
Will try with latest Jellyfin in case they broke something.

I think you can get the used profiles in Jellyfin logs when playing from the Android jellyfin app and selecting external player.

So yes Ffmpeg no more works with mkv or mp4 hls :frowning:
The good new is that now both Mx and VLC mostly properly handle the ts hls produced by Jellyfin simplify handling. (hls is necessary to allow seeking from an external video app). (Mx does not support it with HW profile no image but works with SW and HW+ so I’ll go with it.

As a workaround until next version you can use VLC and select it as a player in settings, this will not use hls so won’t allow seeking but will properly transcode.

Yahooo! I’m a beta tester so I’ll be keen to try it out! Thanks very much for digging into the problem!

No builds before at least 10 days :slight_smile:

Hi! I’m running on 9.5.5 and saw the changelog that it was addressed! Its looking pretty smooth for me! Thanks again for jumping on this!

Thank you Tolriq! I was having the same issue and now it is solved :smiley: