I'm using FFMPEG to burn in subtitles using a command like this:
ffmpeg -i video.mp4 -vf "subtitles=subs.srt:force_style='Fontsize=24,PrimaryColour=&H0000ff&'" -c:a copy output.mp4
I'd like to create a sort of preview of what the the encoded file with subtitles will look like in the browser before the user clicks "Encode video". I've been creating a DIV with each bit of text from the .srt file and overlaying it on top of a VIDEO tag. I've then been fiddling with the font-size, positioning, color, etc. but just can't get it right. It would be nice if there were some sort of FFPLAY for the browser.
Is there some sort of approach/technique for creating an in-browser preview prior to encoding with FFMPEG?
Use WebVTT in your HTML5 video player. CSS is used for styling.
You can use ffmpeg to convert the SRT to VTT:
ffmpeg -i input.srt output.vtt
Related
I need to add a text to a video using ffmpeg and it needs to be with perspective like in the image.
img
i have tried with perspective but i get perspective into the whole video not only the text.
How can i do this?
You want to add a text overlay, so your best option is to pick a perspective font and use that, with the drawtext filter.
Here's an example with the font Therp. It isn't perfect but might point you in the right direction.
ffmpeg -i input.mp4 -vf "drawtext=fontfile=./.fonts/Therp.ttf:text='Perspective': x=300: y=300:font='Therp Regular':fontsize=40:fontcolor=white:" -c:a copy -f matroska - | ffplay -autoexit -i -
Result:
I have a set of transparent images, where each one represents a frame of a video. I know that I can overlay them on top of another video using -i %d.png. What I want to be able to do is turn them into a transparent video ahead of time, and then later be able to overlay that transparent video onto another video. I've tried just doing -i %d.png trans.mov and then overlaying trans.mov on top of another video, but it doesn't seem like trans.mov is actually transparent.
You have to use an encoder that supports transparency/alpha channel. You can view a list of encoders with ffmpeg -h encoders and get further details with ffmpeg -h encoder=<encoder name>, such as ffmpeg -h encoder=qtrle. Then refer to the Supported pixel formats line: if has as "a" in the supported pixel format name, such as rgba, then it supports alpha. See a general list of pixel formats with ffmpeg -pix_fmts.
The simplest solution is to mux the PNG files into MOV:
ffmpeg -framerate 25 -i %d.png -c copy output.mov
I am generating an animated gif from an mp4 ... but due (I think) to color reduction (gif requires -pix_fmt rgb24) the result is somewhat ... blotchy? like running an image through an oil paint (or maybe "posterize") special effect filter. I think that the quality could be better, but I don't know what to tweak.
Not sure about this ... but ooking at the color palette of the resulting gif in an image editor it does not even appear to have attempted to create a color palette specific to this clip, but instead is attempting to us a generic palette ... which wastes a lot of pixmap space. That is, if I am interpreting this correctly.
Any tips on preserving the original video image instead of getting a "posterized" animated gif?
To get better looking gifs, you can use generated palettes. palettegen filter will generate a png palette to use with the paletteuse filter.
ffmpeg -i input.mkv -vf palettegen palette.png
ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
You can try using -vf format=rgb8,format=rgb24.
So I thought to embed the image as part of video content while converting the m4a to mp4. The output file has the image as video content and it plays as expected in VLC but when the same was streamed from my CDN using JW player, I do not see the image as video content, still it is black and audio is heard. Not sure what is the issue with embeding. I used the FFMPEG to embed image as video content.
On the other hand is there any posibility with JW player to overlay an image as video content while audio can be heard in back end?
You need
to loop
the image
ffmpeg -loop 1 -r 1 -i img.png -i audio.m4a -shortest -filter:v \
'crop=trunc(iw/2)*2:trunc(ih/2)*2' out.mp4
repeat image over and over
once per second
stop video when audio stops
cut image to even dimensions if necessary
I have a PNG (alpha) file and a video file. I want to create a video in which the first track is the image and the second track is the video (PNG over video). The problem is that the PNG doesn't preserves transparency.
I need create a watermark (PNG) in a separate track with ffmpeg over video track.
ffmpeg -i base.mov -i logo.png -map 0 -map 1 output.mov
I needed the watermark is on a track (stream) separately in order to enable or disable it with quicktime pro.
Thanks.