Jellyfin Forum
Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Off Topic (https://forum.jellyfin.org/f-off-topic)
+--- Forum: General Discussion (https://forum.jellyfin.org/f-general-discussion)
+--- Thread: Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) (/t-encoding-discussion-megathread-ffmpeg-handbrake-av1-etc)

Pages: 1 2 3 4 5 6 7 8 9 10


RE: Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) - bitmap - 2023-10-09

Quote:I know Rokus ask for H265.

I've heard this a lot, but every transcode my Rokus receive is H264. I've never seen H265 requested or received. Any idea where this info comes from or is documented @TheDreadPirate? Or how I can make this behavior happen? Not that it matters all that much, but when traveling, H265 over my hotspot would be much higher quality than bloated H264.


RE: Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) - TheDreadPirate - 2023-10-09

(2023-10-09, 06:34 PM)bitmap Wrote:
Quote:I know Rokus ask for H265.

I've heard this a lot, but every transcode my Rokus receive is H264. I've never seen H265 requested or received. Any idea where this info comes from or is documented @TheDreadPirate? Or how I can make this behavior happen? Not that it matters all that much, but when traveling, H265 over my hotspot would be much higher quality than bloated H264.

My friend accesses my server with a Roku 4800X and all their transcodes are TO H265.  Even my CCwGTV which plays H265 when direct playing will get H264 transcodes when burning in subs.


RE: Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) - TheDreadPirate - 2023-10-27

What ffmpeg options do I use to scale 4K videos to 1080P?  And, of course, how would that handle the HDR side channel?  Working on making 1080P SDR versions of my 4K HDR media so I can keep the 4K media in a separate library.


RE: Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) - Deleted User - 2023-10-27

(2023-10-27, 02:18 AM)TheDreadPirate Wrote: What ffmpeg options do I use to scale 4K videos to 1080P?  And, of course, how would that handle the HDR side channel?  Working on making 1080P SDR versions of my 4K HDR media so I can keep the 4K media in a separate library.

give this a try, i use a variation of it

run in the jellyfin server/docker, uses jellyfin's ffmpeg which is already setup for hwaccel

produces yuv420p10le, VBR min 50M max 60M (very high bitrate, probably lower would be better)

add -map 0:s if you want to copy subs, audio is already copied

adding 'setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709' to -vf produces a 709 but looks washed out

set width 1920, maintain aspect for height

Code:
/usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -init_hw_device vaapi=va:,driver=iHD -filter_hw_device va -hwaccel vaapi -hwaccel_output_format vaapi -autorotate 0 \
-i <input.mkv> -threads 4 -vf 'scale_vaapi=w=1920:h=-2' \
-map 0:0 -map 0:a -c:0 hevc_vaapi -c:a copy -c:s copy -tag:v:0 hvc1 -rc_mode VBR -b:v 50M -maxrate 60M -y output.mkv


any ffmpeg gurus please point out my flaws, its just put together from the documentation


RE: Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) - bitmap - 2023-10-27

QSV has scale filters as well. Tonemapping is something I haven't gotten into, but I'll run some trials and see what I come up with.


RE: Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) - TheDreadPirate - 2023-10-30

Got it working.

Tone mapping is handled with these parameters in the video filters section.

zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p

I have not tested if the scaler can be before the tone mapping (fewer pixels to tone map?).

Code:
/usr/lib/jellyfin-ffmpeg/ffmpeg
-init_hw_device vaapi=va:,driver=iHD,kernel_driver=i915
-init_hw_device qsv=qs@va
-filter_hw_device qs
-hwaccel qsv
-hwaccel_output_format qsv
-i 'Dungeons and Dragons - Honor Among Thieves.mkv'
-map 0:v
-map 0:a
-map 0:s
-map_chapters 0
-c:v hevc_qsv
-preset slower
-profile:v main
-pix_fmt nv12
-c:a copy
-c:s copy
-ss 0.000000
-to 8048.160000
-global_quality:v 18
-vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p,scale_qsv=w=1920:h=-1
'Dungeons and Dragons - Honor Among Thieves-chapter-0-15.mkv'



RE: Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) - TheDreadPirate - 2023-10-31

Also, Arc A380 is in the mail.


RE: Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) - bitmap - 2023-10-31

Nice work on tone-mapping. I've heard you can get some really good results from down-scaling and tone-mapping 4K > 1080p, though most folks use SDR sources instead, I assume because they're already taking days to encode something. The A380 is a beast when it comes to newer media, but struggles a bit with older material or anything with even a medium amount of grain. Really hoping documentation and features start pouring in for QSV encoding.


RE: Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) - TheDreadPirate - 2023-10-31

Thinking ahead a bit, how do I tell ffmpeg which device to use? Will it automatically use the A380? Or will I have to specify that?


RE: Encoding Discussion Megathread (ffmpeg, Handbrake, AV1, etc...) - TheDreadPirate - 2023-10-31

If I'm reading this document right, I only need to change this line from

Code:
-init_hw_device vaapi=va:,driver=iHD,kernel_driver=i915

To

Code:
-init_hw_device vaapi=va:/dev/dr/renderD129,driver=iHD,kernel_driver=i915