9 ms·
FFmpeg Drawtext Filter for Overlays, Scrolling Text, Timestamps on Videos
- rado 6y agoFFmpeg has almost never worked for me on simple conversion jobs, now adding such advanced features.
- ironmagma 6y agoWhat are you using it for? I have the opposite experience - where almost anything or everything else fails, ffmpeg is able to handle it.
- ponderingfish 6y agoIt's actually super powerful and useful for simple one-off encodes or complex batch processes. I have worked for clients who required an end-to-end transcoding pipeline (ABR) with packaging, subtitles, multiple-audio, etc. and it took a 100 line shell script to get everything done.
- pantelisk 6y agoI am curious if you would like to share your experiences. I use FFmpeg (almost) daily and I would go as far as saying it is one of the most reliable pieces of software I 've ever used.
- yorwba 6y agoIt all depends on what kind of data you're feeding it. I'd been using ffmpeg for years without ever seeing it segfault, until I started processing videos at an unusually small resolution and suddenly it crashes a lot. (But nondeterminstically, so I can put the command in a loop and it'll eventually finish successfully.) Well, I submitted a core dump via Ubuntu's Apport and hopefully someone will have a look at it.
- _Gyan_ 6y agoFor quicker triage, open a ticket at trac.ffmpeg.org.
- FraKtus 6y agoIt's true that if you simply use it on it's simple form such as "ffmpeg -i in.mp4 out.mov" the default bitrate will favour creating small files that will have artefacts, as soon as you set the right option you get very nice results.
- dv35z 6y agoCan you share any typical settings you recommend? I’m experiencing small amounts of artifacts, would love to know of someone’s “safe default”. Thanks!
- harrygeez 6y agoI think a Magit-like interface for ffmpeg would make ffmpeg much easier to use
- ponderingfish 6y agoI usually steer new-comers to Handbrake. That's a great starting point.
- shakna 6y agoReally? For simple conversions? I've been running basically this, which is a simple conversion to ogv, mp4, and VP9 webm, with a tiny bit of audio cleaning: ffmpeg -y -nostdin -i $f -threads 8 -codec:v libtheora -qscale:v 4 -codec:a libvorbis -af afftdn -qscale:a 0 $f.ogv -codec:v libvpx-vp9 -qscale:v 4 -codec:a libvorbis -af afftdn -qscale:a 0 $f.webm -codec:v mpeg4 -codec:a aac -af afftdn -qscale:a 0 -qscale:v 4 $f.mp4 Across a huge dataset from a huge number of backgrounds, usually incredibly crap, for about 18 months, now. Without downtime. And with decent quality output, or at least pretty close to equal the input (did I mention it is often incredibly bad? Including near-broken files, and even some files with less than 20,000 pixels, total). I'm not sure exactly what "never worked" means without more detail, but I'd say it's a workhorse.
- fareesh 6y agoDoes anyone have some experience with this use-case: I have a MP4 file and a SRT file with subtitles is there a convenient way to re render the video with subtitles drawn on it so I can use it in places where subtitles are not supported? Is it a super cpu intensive process that takes a long time for let's say a typical 2 hour movie?
- ponderingfish 6y agoBurning subtitles into the video implies re-encoding. And if you want maintain video quality, you'll have to choose a pretty good quality setting like crf=24 and this will take a lot of time even on H.264/AVC. You are looking at multiple hours (>2) for a 2-hour movie from my experience. One way to reduce this is to spin up a DigitalOcean droplet (a $80 per month droplet) that'll give you a lot of processing power, finish your encoding in 2-3 hours,and shut it down. It'll save you a lot of headache and time. Not sure I answered your question, but, hope that helped!
- twic 6y ago> Burning subtitles into the video implies re-encoding In principle, would it be possible to only re-encode the macroblocks affected by the subtitles, leaving the rest of the frame bit-for-bit identical? It's been a long time since i read a video encoding specification, so i don't know if things still work this way.
- beagle3 6y agoMuch harder than it sounds because future macroblocks depend on present ones, and motion vectors mean that over a few seconds, transitive dependency can reach the entire image (and does in panned and zoomed shots) Can possibly work, but depending on movie content might not save all that much encoding.
- _Gyan_ 6y agoWhat would be much better would be to encode an overlay raster stream, which the player can then composite at runtime, like they do with text subtitles. Much faster to encode. Can be toggled. But players need to support it.
- est 6y agoMy experience with fmpeg is like a DSL embedded into another DSL. It's very powerful yet confusing at times. I saved a ton of ffmpeg one-liners in a notebook just in case.
- pfortuny 6y agoYes, same here. The big problem is that the filters DSL is probably too complex because it uses too many short expressions. It is unbelievably powerful though.
- ponderingfish 6y agoVery true. And, the parameters change over time, but, the stackoverflow answers using the old parameters remain on top. This IMO adds to the confusion :)
- _Gyan_ 6y agoYes, the stackexchange (implicit) model contributes to this. It assumes once a Q has been asked and answered, the issue is resolved. Due to the non-duplicates policy, any corrections or updates are supposed to be added to the same thread. But the original accepted answer will have a tick mark next to it and likely a high score. So naive users don't read further and the obsolete answers remain heeded. Some sort of deprecation or salience decay needs to be added.
- madeofpalk 6y agoYou can edit the accepted answer!
- _Gyan_ 6y agoI don't like to mix voices - that's inorganic when the changes are more than minor and can lead to parts of the 'answer' being at odds with itself. Except for typos, syntax..etc, I don't edit someone else's answer; I leave a comment and let the original respondent edit.
- 6y ago
- pfortuny 6y agoBy the way, I have just donated to this awesome project (the comments I made previously have reminded me that I had not done so...).
- vianneychevalie 6y agoI am not a native English speaker and needed a translation for OTT (Over The Top). Here's a link from this very website (hard to find): https://ottverse.com/what-is-ott-video-streaming/ https://ottverse.com/what-is-ott-video-streaming/
- The_rationalist 6y agoIs there a SAAS that enable the powers of ffmpeg filters through a user friendly gui?
- modernlearner 6y agoThere's this: https://github.com/mifi/lossless-cut https://github.com/mifi/lossless-cut My startup is using ffmpeg filters to create video courses so the GUI is aimed towards that use case rather than being flexible: https://blog.modernlearner.org/product-update-split-content-into-two-clips/ https://blog.modernlearner.org/product-update-split-content-... The results aren't bad: https://www.youtube.com/watch?v=L-NjLrwTyxs https://www.youtube.com/watch?v=L-NjLrwTyxs Great results depend on fine-tuning of the ffmpeg filters and having great quality video to work with. The ffmpeg filter mini-language is easy to work with when you're targeting a particular use-case.
- kohanz 6y agoProbably not exactly what you mean, but the closest I can think of would be https://www.kapwing.com/ https://www.kapwing.com/
- dqv 6y agoHere's mine for doing crab videos ffmpeg -ss 66 -i crab.mp4 -t 30 -crf 27 -preset veryfast -vf "drawtext=fontfile=/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf:text='YOUR TEXT HERE':fontcolor=white:fontsize=240:shadowx=5:shadowy=5:box=1:boxcolor=black@0.0:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2:enable='between(t,9,30)',scale=iw/3:ih/3" -c:v libx264 -filter:a "volume=0.2" -c:a libmp3lame output.mp4 You just need to get the original crab rave video from youtube: https://www.youtube.com/watch?v=LDU_Txk06tM https://www.youtube.com/watch?v=LDU_Txk06tM You might also need to supply your own font path I'm not sure how universal they are.
- jjice 6y agoWhen I switched to Linux and started using FFmpeg, the idea of automating video production (this thing that was so time intensive in my mind) was so appealing. This is an awesome little example. What a damn good piece of software.
- ralph87 6y agoJust wait until you try out Gstreamer (and suffer a few weeks learning it! I don't even remember C++ being so painful)
- FR10 6y agoI downloaded the video (720p) and I have to tweak slightly the command to make it work on MacOS Catalina (FFmpeg installed via brew) ffmpeg -ss 66 -i crab.mp4 -t 30 -crf 27 -preset veryfast \ -vf "drawtext=fontfile=~/Library/Fonts/SF-Compact-Display-Bold.otf:text='YOUR TEXT HERE':fontcolor=white:fontsize=68:shadowx=5:shadowy=5:box=1:boxcolor=black@0.0:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2:enable='between(t,9,30)'" \ -c:v libx264 -filter:a "volume=0.2" output.mp4 Thank you very much, crazy how powerful but hard is FFmpeg.
- dqv 6y agoAh yes! Sorry the settings I posted are for the original crab rave music video in 4k.
- 6y ago
- modernlearner 6y agoThis is great, ffmpeg has a lot of great utilities within it. I'm using it for creating short videos: https://www.youtube.com/watch?v=L-NjLrwTyxs https://www.youtube.com/watch?v=L-NjLrwTyxs And I'm scratching the surface since ffmpeg has so many amazing filters: https://ffmpeg.org/ffmpeg-filters.html https://ffmpeg.org/ffmpeg-filters.html
- aSig 6y agoDoes anyone know of an effecient way of overlaying lowerthirds graphics onto live video with ffmpeg? Ideally the overlay would be a webpage.