Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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"`


According to Yle they only started using Tiresias in 2012. The article doesn't mention which font they were using before. I would be interested in their 90s font as well.

Source: https://yle.fi/aihe/artikkeli/2012/01/27/televisiokanavien-t...


Interesting, I haven't really watched Finnish TV past ten years. However it can't be too different from Tiresias, it was tall as well, and pretty big outline. You can see the 90s font here:

https://youtu.be/enNnlLcSl9I?t=90

Edit: Comparing 90s font to Tiresias, I would too like to have that exact font they used in 90s. E.g. big "J" is terrible in Tiresias compared to that.


Neither have I. You are right that they are quite similar but not identical.

Ps. Never thought I'd discuss Yle subtitles at Hacker News. Thank you for your comment! :)


Been following the VLC subtitles/Chromecast issue for several years now. Thank you so much for this!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: