jellyfin / jellyfin-ffmpeg

FFmpeg for Jellyfin
https://jellyfin.org
Other
445 stars 118 forks source link

Odroid XU4 NV21 #184

Open RicardoCst opened 1 year ago

RicardoCst commented 1 year ago

Possibly missing a pixel format for the odroid xu4? Adding -pix_fmt nv21 to the default jellyfin-ffmpeg line for some reasons works.

Without -pix_fmt nv21 /usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -autorotate 0 -i file:"/media/INTHDD1/Content1/Films/lol.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_v4l2m2m -b:v 5085275 -maxrate 5085275 -bufsize 10170550 -level 51 -force_key_frames:0 "expr:gte(t,0+n_forced*3)" -g:v:0 72 -keyint_min:v:0 72 -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,min(1920\,820*a))/64)*64:trunc(min(max(iw/a\,ih)\,min(1920/a\,820))/2)*2,format=yuv420p" -codec:a:0 libfdk_aac -ac 2 -ab 384000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/var/lib/jellyfin/transcodes/a605d70e11ba86c2fc2e82f2f70f4e65%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/var/lib/jellyfin/transcodes/a605d70e11ba86c2fc2e82f2f70f4e65.m3u8"

image

With -pix_fmt nv21 /usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -autorotate 0 -i file:"/media/INTHDD1/Content1/Films/lol.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_v4l2m2m -b:v 5085275 -maxrate 5085275 -bufsize 10170550 -level 51 -force_key_frames:0 "expr:gte(t,0+n_forced*3)" -g:v:0 72 -keyint_min:v:0 72 -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,min(1920\,820*a))/64)*64:trunc(min(max(iw/a\,ih)\,min(1920/a\,820))/2)*2,format=yuv420p" -codec:a:0 libfdk_aac -ac 2 -ab 384000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "/var/lib/jellyfin/transcodes/a605d70e11ba86c2fc2e82f2f70f4e65%d.ts" -hls_playlist_type vod -hls_list_size 0 -y -pix_fmt nv21 "/var/lib/jellyfin/transcodes/a605d70e11ba86c2fc2e82f2f70f4e65.m3u8"

image

EDIT: Kernel version 5.4 on armbian

coolfdu1 commented 1 year ago

Please revert back to jellyfin 10.7.7, which is the last version with -pix_fmt nv21 support by default for v4l2m2m, which is not compatible or optimal for the Raspberry Pi 4.

artu-ole commented 1 year ago

Can confirm that downgrade works, though that'd be great if that was an option or a flag. In the meantime, on the latest version a simple workaround as creating a script that would substitute format=yuv420p for format=nv21, putting it next to real ffmpeg executable(so that ffprobe is in the same folder) and pointing jellyfin to it worked for me on odroid xu4. Here's a sample sctipt

#!/bin/bash

# Replace "yuv420p" with "nv21"
NEW_ARGS=${@//format=yuv420p/format=nv21}

# Get the full path of the directory containing this script
current_folder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# Build the full path to the "ffmpeg" executable
ffmpeg_exe="${current_folder}/ffmpeg"

# Run the command with the updated arguments
${ffmpeg_exe} ${NEW_ARGS}
RicardoCst commented 1 year ago

Or maybe an advanced setting for setting the format? Like a checkbox or dropdown menu? I dont know if it is worth the time though. Maybe @nyanmisaka could help because I wouldnt know how to do that?