Encoding settings - non-optimal to use bitrate limit from input?

I’m just playing with encoding here.

It looks like JF ffmpeg transcodes with a “max bitrate” flag set to the input file bitrate. I’ve checked with 3 or 4 different files and watching the webGUI admin readout that watches clients streams.
I’ve also reviewed the logs.
In all videos, the stream transcoded bitrate is set very near the input bitrate.
I assume this maxrate ffmpeg flag is indeed limiting the encoding bitrate.

Please don’t judge on the choice of film haha, just taped it the other night.

Input file:

"Protocol":"File","Id":"03443ab2318957a8da6783e8272e647d","Path":"X:\\media\\films\\Kingsman The Golden Circle (2017)\\Kingsman The Golden Circle (2017).ts","Type":"Default","Container":"mpegts","Size":4230383104,"Name":"Kingsman The Golden Circle (2017)","IsRemote":false,"ETag":"506f8c50e78574c2eb4f644e8c3ffd34","RunTimeTicks":109218398208,"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":"mpeg2video","TimeBase":"1/90000","CodecTimeBase":"1/25","VideoRange":"SDR","DisplayTitle":"480i MPEG2VIDEO","IsInterlaced":true,"BitRate":3098659,"RefFrames":1,"IsDefault":false,"IsForced":false,"Height":576,"Width":704,"AverageFrameRate":25,"RealFrameRate":25,"Profile":"Main","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":8},{"Codec":"mp2","Language":"NAR","TimeBase":"1/90000","CodecTimeBase":"1/48000","DisplayTitle":"NAR MP2 stereo","IsInterlaced":false,"ChannelLayout":"stereo","BitRate":128000,"Channels":2,"SampleRate":48000,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0},{"Codec":"mp2","Language":"eng","TimeBase":"1/90000","CodecTimeBase":"1/48000","DisplayTitle":"Eng MP2 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":"dvbsub","Language":"eng","TimeBase":"1/90000","CodecTimeBase":"0/1","localizedUndefined":"Undefined","localizedDefault":"Default","localizedForced":"Forced","DisplayTitle":"Eng","IsInterlaced":false,"IsDefault":false,"IsForced":false,"Type":"Subtitle","Index":3,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0},{"Codec":"dvb_teletext","Language":"eng,eng","TimeBase":"1/90000","localizedUndefined":"Undefined","localizedDefault":"Default","localizedForced":"Forced","DisplayTitle":"Eng,eng","IsInterlaced":false,"IsDefault":false,"IsForced":false,"Type":"Subtitle","Index":4,"IsExternal":false,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Level":0}],"MediaAttachments":[],"Formats":[],"Bitrate":3418659,"RequiredHttpHeaders":{}}

FFmpeg string:

C:\Program Files\Jellyfin\Server\ffmpeg.exe -hwaccel d3d11va -i file:"X:\media\films\Kingsman The Golden Circle (2017)\Kingsman The Golden Circle (2017).ts" -map_metadata -1 -map_chapters -1 -threads 2 -map 0:0 -map 0:2 -map -0:s -codec:v:0 libx264 -pix_fmt yuv420p -preset ultrafast -crf 19 -maxrate 3098659 -bufsize 6197318 -profile:v high -level 4.1 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none  -force_key_frames:0 "expr:gte(t,0+n_forced*3)" -g 75 -keyint_min 75 -sc_threshold 0 -vf "yadif=0:-1:0,scale=trunc(min(max(iw\,ih*dar)\,1280)/2)*2:trunc(ow/dar/2)*2" -start_at_zero -vsync -1 -codec:a:0 libmp3lame -ac 2 -ab 192000  -copyts -avoid_negative_ts disabled -f hls -max_delay 5000000 -hls_time 3 -individual_header_trailer 0 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "C:\ProgramData\Jellyfin\Server\transcodes\82e7dde99afbe243c54adb9865bb1aef%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "C:\ProgramData\Jellyfin\Server\transcodes\82e7dde99afbe243c54adb9865bb1aef.m3u8"

If you generated that input file with a “very slow” ffmpeg preset then the quality vs bitrate will be very efficient, so you got great quality for the bitrate.
In this specific case it’s an SD .ts stream, but for storage I’ll likely use veryslow ffmpeg encoding to get sizes down. However, ultrafast can see 10x the bitrate with the same quality.

When encoding for storage you want small file sizes, and you’re happy to encode once at very high CPU load and energy usage, since it’s a one time pass.
When encoding for streaming/transcoding, you may want it to be very low on CPU/server load/energy consumption, and not be so concerned about network bandwidth, so running well over the input bitrate is necessary.

It does seem on the face of it, that currently the transcoding encoding is probably costing many users visual quality and power usage just because it’s arbitrarily using a too low bitrate, picked just because the input file used that rate… which really isn’t a relevant guide given it’s the result of different encoding requirements to transcode streaming.

Is there a way to remove this bitrate limiting on transcodes?

If I want to limit the LAN transcode bitrate I can just use a slower setting. If it’s over the web then I assume the ‘streaming’ bitrate limiter is invoked any way.

Ideally we’d just have a limiter for web streaming and lan streaming, and then not limit bitrate as a default based upon the input bitrate.

Thanks