@schappi here’s how I hardsub. it’s probably not the best way, but it works usually.
# Extract Subs # find out which track the subtitle is, look for 'track ID for mkvextract' mkvinfo s01e07.mkv # next extract the srt mkvextract tracks s01e07.mkv 4:s01e07.srt # Convert # simple scenario where there's just the sub you wanna add # the platform says to add -movflags +faststart, but it works also without ffmpeg -i ${1}.mkv -movflags +faststart -vf "subtitles=${1}.srt" ${1}s.mp4 # if the source has several video or audio streams, use the -map to select which. here I select the video stream 0 and the audio stream 2 - it's the track ID from the mkvinfo. so if you wanted the third track, it would be 0:3 # the -b:v sets a bitrate of 2M in this case ffmpeg -i ${1}.mkv \ -map 0:0 -map 0:2 \ -vf "subtitles=${1}.srt" \ -b:v 2M ${1}s.mp4 # and here's what I currently use for Tomo: ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i ${1}.mkv \ -map 0:0 -map 0:2 \ -vf "format=nv12,subtitles=${1}.srt:force_style=fontcolor=white,hwupload=extra_hw_frames=30" \ -b:v 2M \ -c:v h264_vaapi -c:a copy ${1}s.mp4Conversation
Notices
-
kaia (kaia@brotka.st)'s status on Monday, 16-Oct-2023 06:26:31 JST kaia -
cool_boy_mew (coolboymew@shitposter.club)'s status on Monday, 16-Oct-2023 06:26:29 JST cool_boy_mew @romin @kaia @schappi The command we use for the movie nights
ffmpeg -i "input.mkv" -vf subtitles="input.mkv" -c copy -c:s mov_text -acodec aac -strict experimental -ac 2 -ab 128k -vcodec libx264 -preset slow -f mp4 -crf 22 output.mp4
Optionally add -s 640x360 after "22" to downscale video -
ロミンちゃん (romin@shitposter.club)'s status on Monday, 16-Oct-2023 06:26:30 JST ロミンちゃん @kaia @schappi you can also extract subtitles using ffmpeg
`ffmpeg -i file.mkv sub.srt` (can add `-map 0:s:$idx` if you don't want the first sub track) -
cool_boy_mew (coolboymew@shitposter.club)'s status on Monday, 16-Oct-2023 06:41:17 JST cool_boy_mew @Eiregoat @kaia @schappi @romin
>Why
Not my command and I don't understand a thing that goes here lmao -
:spinnenrad: Festivegoat :spinnenrad: (eiregoat@nicecrew.digital)'s status on Monday, 16-Oct-2023 06:41:18 JST :spinnenrad: Festivegoat :spinnenrad: Why do you set codecs to copy then override with specified video and audio codecs?
Also, if you're trying to control filesize by downscaling, I've found restricting the video bitrate works better, like "-b:v 2M"
For quality of life I'd also suggest using:
"-y" automatically overwrites files if you have to make multiple attempts
"-hide_banner -loglevel error" cuts out some of the spam
"nice ffmpeg" restricts ffmpeg from grabbing too much system resources if there's a lot going on in the background. Obviously runs a bit slower though. -
ロミンちゃん (romin@shitposter.club)'s status on Monday, 16-Oct-2023 06:46:42 JST ロミンちゃん @coolboymew @kaia @schappi oh right ffmpeg can fetch the subs from the container too cool_boy_mew likes this. -
cool_boy_mew (coolboymew@shitposter.club)'s status on Monday, 16-Oct-2023 06:46:54 JST cool_boy_mew @romin @kaia @schappi yeah, and it's real useful -
cool_boy_mew (coolboymew@shitposter.club)'s status on Monday, 16-Oct-2023 06:49:58 JST cool_boy_mew @romin @kaia @schappi yeah, that's what I do and I do it directly on the folder because or else it seems to glitch out -
ロミンちゃん (romin@shitposter.club)'s status on Monday, 16-Oct-2023 06:49:59 JST ロミンちゃん @coolboymew @kaia @schappi you need to rename the input file beforehand although, because ffmpeg doesn't play nice with certain characters inside the filter string
-