I have one glorious: ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input.mp4 -vf "hwdownload,format=nv12,scale=(iw*sar)*max(1280/(iw*sar)\,720/ih):ih*max(1280/(iw*sar)\,720/ih), crop=1280:720, subtitles=input.srt:force_style='FontName='TiresiasScreenfont',Fontsize=32,Outline=2,MarginL=50,MarginV=30,Alignment=1',minterpolate=fps=60:mi_mode=blend" -c:v h264_nvenc -preset slow -b:v 8M -f matroska - | vlc -
What it does: Allows streaming content to Chrome Cast with my idea of subtitles through VLC.For me I want subtitles with Tiresias screen font used in Finnish YLE 90s. (Aligned always to left second row, so that starting point is always the same. Center alignment is bad because you need to always re-adjust eyes to the position where the subtitles start, left alignment makes the first character always in same place.) * `hwaccel cuvid -c:v h264_cuvid` * makes the hardware accelerated decoding (h264 only) * `-vf` * video filter * `hwdownload,format=nv12` * downloads the hardware accelerated frame to memory for the video filter (required by cuvid) * `scale=(iwsar)max(1280/(iwsar)\,720/ih):ihmax(1280/(iw*sar)\,720/ih), crop=1280:720` * crops the video to 1280x720, (exteremely high impact on performance!) Use crop and resize cuvid below for better performance. * `subtitles=input.srt:force_style='FontName='TiresiasScreenfont',Fontsize=32,Outline=2,MarginL=50,MarginV=30,Alignment=1'` * subtitles * `-c:v h264_nvenc -preset slow -b:v 8M` * hardware accelerated encoding 8000 kb/s for 720p/60 (for 1080p use `16M`) * `-f matroska * | vlc -` * output as matroska, pipe to VLC * `minterpolate=fps=60:mi_mode=blend` * output 60 fps interpolate blending (this can cause problems, avoid sometimes) Crop and resize with cuvid example: * `-hwaccel cuvid -crop 0x0x200x200` - faster way to crop top x bottom x left x right * `-hwaccel cuvid -resize 1200x300` - resize (forces the size) Seek example: Seek to 30 minutes (60*30 = 1800) ffmpeg -ss 1800 ... vf "hwdownload,format=nv12,setpts=PTS+1800/TB,subtitles='...',setpts=PTS-STARTPTS"`
|
Source: https://yle.fi/aihe/artikkeli/2012/01/27/televisiokanavien-t...