Currently I do it this way: ffmpeg -i video.mp4 -vf ass=subs.ass output.mp4
.
But with some videos it takes too long.
Is there way to increase speed of that: may be saving output file with lesser quality or something?
-
The bottleneck is likely hardware related 1) slow write speed, are you writing out to an SSD? A 7200 RPM spinning disk? A network share? 2) slow CPU. Can you upgrade to a newer CPU? 3) RAM cap. Are you hitting a memory limit on the machine?– spikey_richieAug 13, 2020 at 9:47
-
@spikey_richie HDD, no memory limit, it's not used much, can't upgrade CPU.– R StAug 13, 2020 at 9:52
-
OK, so then yeah I guess your next step is to render the whole thing to a lower frame rate, or lower resolution– spikey_richieAug 13, 2020 at 10:17
2 Answers
- Use a faster
-preset
(assuming you are using the encoder libx264). - Stream copy the audio instead of re-encoding it with
-c:a copy
(assuming the input audio is AAC). - Use softsubs instead of hardsubs (assuming your player accepts them) and avoid re-encoding entirely with stream copy. Either output to MKV and mux the ASS files, or use MP4 with
-c:s mov_text
. - Experiment to see if a hardware accelerated encoder is faster.
-
Thanks for response, llogan. I tried this, no difference:
ffmpeg -i INPUT.mp4 -vf ass=SUBS.ass OUTPUT.mp4 -c:v libx264 -preset ultrafast -crf 22 -c:a copy
– R StAug 14, 2020 at 1:47 -
1@RSt Option placement matters. Your command has trailing options that are ignored. Use
ffmpeg -i INPUT.mp4 -vf ass=SUBS.ass -c:v libx264 -preset ultrafast -crf 22 -c:a copy OUTPUT.mp4
– lloganAug 14, 2020 at 19:07 -
it does it, thank you very much! Do trailing arguments always (often) ignored in command line or it's in this program specifically?– R StAug 15, 2020 at 11:31
-
1
I've found this works for me and it is very Fast.
ffmpeg -i "$input_file" -i "$subt_file" -c copy -c:s mov_text "$savefile"
Also, if I need to delay subtitles I use this:
ffmpeg -itsoffset 3.68 -i "/Plex/work/GC.srt" -c copy xx.srt