Create a watermark in a separate track with FFmpeg - ffmpeg

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.

Related

FFMPEG to remove audio but keeping background sound

I am trying to add voice over to the existing video which has some audio in English and some background sound. I am trying to add other than English audio on top of it and keeping background sound. But when I add new audio it removes all the background sound and when it adds new audio which makes it robotic as original background sound is lost.
When I add new audio by using amix filter, it keeps all sound like English and new language both, and both plays together.
Is there any way to separate background sound and speaking audio from video separately?
Is it possible to mute or remove audio from only parts of video like offset between time frames?
Command that I am using for add new audio
ffmpeg -i independance_speech.mp4 -i 01.mp3 -filter_complex "[1]adelay=10000[s1];[s1]amix=inputs=2[a]" -map 0:v -map "[a]" -c:v copy result.mp4

Preview FFMPEG subtitles before encoding

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

how to mirror + add logo to video?

how to mirror + add logo to video?
How to mirror video, then add logo to video using ffmpeg?
To flip a video horizontally, you can use -vf hflip (or vflip for vertical flipping).
To add a watermark of any image to a video is more complex, especially if you want to position it:
-i logo.png -filter_complex "overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2"
There are a lot of things you can do with the overlay filter, check the documentation. It gets extremely complex if you also want to scale the overlay, so make sure your logo file is the right size before that.
However, you cannot mix -vf and -filter_complex, so the flipping has to become part of the complex filter. So, for your desired result, you'd have to do this (assuming you want the logo to be at position 10/10):
ffmpeg -i input.mp4 -i logo.png -filter_complex "hflip[flipped];[flipped]overlay=x=10:y=10" out.mp4

iPhone video thumbnail upside down

Quicktime can play it right. But ffmpeg will produce an upside-down thumbnail sometimes.
ffmpeg -i input.MOV -ss 00:00:00.002 -vframes 1 -y output.png
I like to generate thumbnails of correct positions. What are some good remedies?
Thanks
Videos recorded on mobile devices will have a rotation attribute in their metadata. Quicktime uses this to know if it need to rotate the video. Use "MediaInfo" to see your media's metadata, you can download it from here; https://mediaarea.net/en/MediaInfo/Download
If the video is rotated 90' use -vf 'transpose=1', for 180' use -vf 'hflip,vflip'

Embed Image into video - FFMPEG or JW player?

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

Resources