Jump to content

'auto' forces transcode on h265 with Truenas-EE


Recommended Posts

Posted

got a bit of a weird issue.

emby 4.8.10.0
truenas: ElectricEel-24.10.0.2
client: pc Brave browser, pc emby theater from store, android brave browser, android emby theater
reverse proxy: swag docker
using ipv4 only

after upgrading truenas dragonfish to electric eel(switch from kubernetes to docker compose), when playing HEVC files with bitrate above 4Mbps on auto quality emby always forces 1080P/4Mbsp transcoding.
the ways to direct play are either set quality to 1080/60(or 4K/200) or to connect directly to container on http port without reverse proxy.

tried to install clean container from truenas apps, switching to npm reverse proxy

in emby log i found that Bitrate exceeds DirectPlay :

Spoiler
2024-11-14 22:11:23.439 Info Server: http/1.1 POST http://host5/emby/Items/1893/PlaybackInfo?UserId=da2780d8d9a14179aa161a97de36365f&StartTimeTicks=0&IsPlayback=false&AutoOpenLiveStream=false&MaxStreamingBitrate=4000002&X-Emby-Client=Emby Web&X-Emby-Device-Name=Brave Windows&X-Emby-Device-Id=&X-Emby-Client-Version=4.8.10.0&X-Emby-Token=x_secret1_x&X-Emby-Language=en-gb&reqformat=json. Source Ip: host6, UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
2024-11-14 22:11:23.510 Info App: User policy for MyEmbyUser. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
2024-11-14 22:11:23.524 Info App: Bitrate exceeds DirectPlay limit: media bitrate: 5284045, max bitrate: 4000002
2024-11-14 22:11:23.524 Info App: Bitrate exceeds DirectStream limit: media bitrate: 5284045, max bitrate: 4000002
2024-11-14 22:11:23.557 Info App: Bitrate exceeds DirectPlay limit: media bitrate: 5284045, max bitrate: 4000002
2024-11-14 22:11:23.557 Info App: Bitrate exceeds DirectStream limit: media bitrate: 5284045, max bitrate: 4000002
2024-11-14 22:11:23.572 Info App: Bitrate exceeds DirectPlay limit: media bitrate: 5284045, max bitrate: 4000002
2024-11-14 22:11:23.572 Info App: Bitrate exceeds DirectStream limit: media bitrate: 5284045, max bitrate: 4000002

 nginx config:

Quote

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    set $upstream_app 10.0.3.14;
    set $upstream_port 30072;
    set $upstream_proto http;
    access_log /config/log/nginx/emby4-access.log main;
    error_log /config/log/nginx/emby4-error.log;

    server_name emby.example.com;
    include /config/nginx/ssl/example.com.conf;
    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

        proxy_set_header Range $http_range;
        proxy_set_header If-Range $http_if_range;
    }
}
 

proxy.conf:

## Version 2023/02/09 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/proxy.conf.sample

# Timeout if the real server is dead
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;

# Proxy Connection Settings
proxy_buffers 32 4k;
proxy_connect_timeout 240;
proxy_headers_hash_bucket_size 128;
proxy_headers_hash_max_size 1024;
proxy_http_version 1.1;
proxy_read_timeout 240;
proxy_redirect http:// $scheme://;
proxy_send_timeout 240;

# Proxy Cache and Cookie Settings
proxy_cache_bypass $cookie_session;
#proxy_cookie_path / "/; Secure"; # enable at your own risk, may break certain apps
proxy_no_cache $cookie_session;

# Proxy Header Settings
proxy_set_header Connection $connection_upgrade;
proxy_set_header Early-Data $ssl_early_data;
proxy_set_header Host $host;
proxy_set_header Proxy "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Method $request_method;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Uri $request_uri;
proxy_set_header X-Original-Method $request_method;
proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
proxy_set_header X-Real-IP $remote_addr;

 

Spoiler


{"Protocol":"File","Id":"a02882a711db4927fab1d80dd2157095","Path":"/mnt/d/+Tv Shows/Survivor/Season 47/Survivor - S47E06 - Feel the FOMO [MeGusta].mkv","Type":"Default","Container":"mkv","Size":2554857043,"Name":"Survivor - S47E06 - Feel the FOMO [MeGusta]","IsRemote":false,"HasMixedProtocols":false,"RunTimeTicks":38680320000,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[{"Codec":"hevc","ColorTransfer":"bt709","ColorPrimaries":"bt709","ColorSpace":"bt709","TimeBase":"1/1000","VideoRange":"SDR","DisplayTitle":"1080p HEVC","IsInterlaced":false,"BitRate":5284045,"BitDepth":10,"RefFrames":1,"IsDefault":true,"IsForced":false,"IsHearingImpaired":false,"Height":1080,"Width":1920,"AverageFrameRate":30,"RealFrameRate":30,"Profile":"Main 10","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","PixelFormat":"yuv420p10le","Level":120,"IsAnamorphic":false,"ExtendedVideoType":"None","ExtendedVideoSubType":"None","ExtendedVideoSubTypeDescription":"None","AttachmentSize":0},{"Codec":"eac3","Language":"eng","TimeBase":"1/1000","DisplayTitle":"English EAC3 5.1 (Default)","DisplayLanguage":"English","IsInterlaced":false,"ChannelLayout":"5.1","BitRate":640000,"Channels":6,"SampleRate":48000,"IsDefault":true,"IsForced":false,"IsHearingImpaired":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","ExtendedVideoType":"None","ExtendedVideoSubType":"None","ExtendedVideoSubTypeDescription":"None","AttachmentSize":0},{"Codec":"ass","Language":"eng","TimeBase":"1/1000","Title":"English (SDH)","DisplayTitle":"English (ASS)","DisplayLanguage":"English","IsInterlaced":false,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Type":"Subtitle","Index":2,"IsExternal":false,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Protocol":"File","ExtendedVideoType":"None","ExtendedVideoSubType":"None","ExtendedVideoSubTypeDescription":"None","AttachmentSize":0,"SubtitleLocationType":"InternalStream"},{"Codec":"srt","Language":"en","DisplayTitle":"English (SRT)","DisplayLanguage":"English","IsInterlaced":false,"IsDefault":false,"IsForced":false,"IsHearingImpaired":false,"Type":"Subtitle","Index":3,"IsExternal":true,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Path":"/mnt/d/+Tv Shows/Survivor/Season 47/Survivor - S47E06 - Feel the FOMO [MeGusta].en.srt","Protocol":"File","ExtendedVideoType":"None","ExtendedVideoSubType":"None","ExtendedVideoSubTypeDescription":"None","AttachmentSize":0}],"Formats":[],"Bitrate":5284045,"RequiredHttpHeaders":{},"AddApiKeyToDirectStreamUrl":false,"ReadAtNativeFramerate":false,"ItemId":"1893"}

>>>>>>  User policy for MyEmbyUser
        Enable Playback Remuxing: True
        Enable Video Playback Transcoding: True
        Enable Audio Playback Transcoding: True

>>>>>>  Hardware Encoders for h264
        [X] VAAPI Xeon E3-1200 v3/4th Gen Core - H.264 (AVC)
        [X] VAAPI Tonga XT / Amethyst XT [1] - H.264 (AVC)

>>>>>>  Selected Codecs
Decoder Automatic software decoder


Encoder x264
        Max Bitrate: 781 Mbit/s
        Color Formats: YUV420P, YUVJ420P, YUV422P, YUVJ422P, YUV444P, YUVJ444P, NV12, NV16, NV21, YUV420P10, YUV422P10, YUV444P10, NV20, GRAY8, GRAY10 - Bit Depths: 8, 10, 12, 14
        Profiles: Baseline Profile (Level 6.2), Main Profile (Level 6.2), High Profile (Level 6.2), High 10 Profile (Level 6.2), High 4:2:2 Profile (Level 6.2), High 4:4:4 Predictive Profile (Level 6.2)


>>>>>>  FindVideoEncoder - MediaType: h264, UseHardwareCodecs: True, HWA-Mode: Automatic

Warning: Hardware acceleration is not available as it requires a valid Premiere Subscription
Info    Checking: 'x264'
Info    Check successful - selecting 'x264'

>>>>>>  FindVideoDecoder - MediaType: hevc, UseHardwareCodecs: True, HWA-Mode: Automatic
Info    Checking: 'Automatic software decoder'
Info    Check successful - selecting 'Automatic software decoder'

>>>>>>  Processing Plan
        Name                                        CanDoInHW  WillDoInHW  Reason                                                 
        Automatic software decoder               >> False      False       Software Codec                                          
        VideoInput                               >> False      False       Not a hardware decoder                                  
        ColorConversion                          >> False      False                                                               
        VideoOutput                              >> False      False       Not a hardware encoder                                  
        x264                                     >> False      False       Software Codec                                          

>>>>>>  Video Processing Steps for [0:0]: H.265 (HEVC)
        Step                    HW-Context   Format       SW-Format           Size   Next
        HEVC                 >> -            yuv420p10    yuv420p10      1920x1080 >> format
        format               >> -            yuv420p      yuv420p        1920x1080 >> 

/bin/ffmpeg -loglevel +timing -y -print_graphs_file "/config/logs/ffmpeg-transcode-9f91cf11-8c27-49ad-9071-518eb102fafd_1graph.txt" -copyts -start_at_zero -f matroska,webm -c:v:0 hevc -noautorotate -i "/mnt/d/+Tv Shows/Survivor/Season 47/Survivor - S47E06 - Feel the FOMO [MeGusta].mkv" -filter_complex "[0:0]format@f1=pix_fmts=yuv420p[f1_out0]" -map [f1_out0] -map 0:1 -sn -c:v:0 libx264 -g:v:0 90 -maxrate:v:0 3616002 -bufsize:v:0 7232004 -sc_threshold:v:0 0 -keyint_min:v:0 90 -r:v:0 30 -pix_fmt:v:0 yuv420p -preset:v:0 veryfast -profile:v:0 high -x264opts:v:0 "subme=0:me_range=4:rc_lookahead=10:partitions=none" -crf:v:0 23 -c:a:0 libmp3lame -ab:a:0 192000 -ac:a:0 2 -metadata:s:a:0 language=eng -filter:a:0 "volume=2" -disposition:a:0 default -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list "/config/transcoding-temp/5C932A/5C932A.m3u8" -segment_list_type m3u8 -segment_time 00:00:03.000 -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 "/config/transcoding-temp/5C932A/5C932A_%d.ts"

22:11:25.749 ffmpeg version 5.1-emby_2023_06_25 Copyright (c) 2000-2022 the FFmpeg developers and softworkz for Emby LLC
22:11:25.749   built with gcc 10.3.0 (crosstool-NG 1.25.0)
22:11:25.749 Execution Date: 2024-11-14 22:11:25
22:11:25.773 Input #0, matroska,webm, from '/mnt/d/+Tv Shows/Survivor/Season 47/Survivor - S47E06 - Feel the FOMO [MeGusta].mkv':
22:11:25.773   Metadata:
22:11:25.773     ENCODER         : Lavf61.5.101
22:11:25.773   Duration: 01:04:28.03, start: 0.000000, bitrate: 5284 kb/s
22:11:25.773   Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], Level 120, 30 fps, 30 tbr, 1k tbn (default)
22:11:25.773     Metadata:
22:11:25.773       BPS             : 11523948
22:11:25.773       NUMBER_OF_FRAMES: 116040
22:11:25.773       NUMBER_OF_BYTES : 5571828883
22:11:25.773       ENCODER         : Lavc61.11.100 libx265
22:11:25.773       DURATION        : 01:04:28.000000000
22:11:25.773   Stream #0:1(eng): Audio: eac3, 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
22:11:25.773     Metadata:
22:11:25.773       BPS             : 640000
22:11:25.773       NUMBER_OF_FRAMES: 120876
22:11:25.773       NUMBER_OF_BYTES : 309442560
22:11:25.773       DURATION        : 01:04:28.032000000
22:11:25.773   Stream #0:2(eng): Subtitle: ass
22:11:25.773     Metadata:
22:11:25.773       title           : English (SDH)
22:11:25.773       BPS             : 104
22:11:25.773       NUMBER_OF_FRAMES: 1472
22:11:25.773       NUMBER_OF_BYTES : 50360
22:11:25.773       ENCODER         : Lavc61.11.100 ssa
22:11:25.773       DURATION        : 01:04:20.758000000
22:11:25.775 Stream mapping:
22:11:25.775   Stream #0:0 (hevc) -> format:default (graph 0)
22:11:25.775   format:default (graph 0) -> Stream #0:0 (libx264)
22:11:25.775   Stream #0:1 -> #0:1 (eac3 (native) -> mp3 (libmp3lame))
22:11:25.775 Press [q] to stop, [?] for help
22:11:25.806 [libx264 @ 0x23b9b00] using SAR=1/1
22:11:25.806 [libx264 @ 0x23b9b00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
22:11:25.820 [libx264 @ 0x23b9b00] profile High, level 4.0, 4:2:0, 8-bit
22:11:25.859 [libx264 @ 0x23b9b00] 264 - core 163 r3060 5db6aa6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0 me=hex subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=4 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=90 keyint_min=46 scenecut=0 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=3616 vbv_bufsize=7232 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
22:11:25.859 Output #0, segment, to '/config/transcoding-temp/5C932A/5C932A_%d.ts':
22:11:25.859   Metadata:
22:11:25.859     encoder         : Lavf59.27.100
22:11:25.859   Stream #0:0: Video: h264, yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 90k tbn
22:11:25.860     Metadata:
22:11:25.860       encoder         : Lavc59.37.100 libx264
22:11:25.860     Side data:
22:11:25.860       cpb: bitrate max/min/avg: 3616000/0/0 buffer size: 7232000 vbv_delay: N/A
22:11:25.860   Stream #0:1(eng): Audio: mp3, 48000 Hz, stereo, fltp, 192 kb/s (default)
22:11:25.860     Metadata:
22:11:25.860       encoder         : Lavc59.37.100 libmp3lame

 

 

Posted

Hi there @GunbleRhave you compared your nginx configuration to this:

 

  • 1 month later...
Posted

Do you have a local dns server setup that redirects your domain directly to your server's IP address? If you don't, then devices that access your server are getting your home network's ip address, meaning that all traffic is routed trough your modem to your ISP then back into your home network.

 

or maybe Emby clients are smart enough to figure that out, but the web browser access won't be

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...