Watermarking video from the Linux command line - linux

does anyone know how to watermark video from the Linux command line using a simple tool?
Watermarking in ffmpeg isn't supported in the current version, and requires a custom compile.
Max.

ffmpeg -y -i 'inputFile.mpg' -vhook '/usr/lib/vhook/watermark.so -f /home/user/logo.gif'
Make note of the "-vhook" parameter; watermark.so path may vary.

Another simple way to do this is updating ffmpeg to the newest version and adding the overlay video filter:
ffmpeg -y -i video.mp4 -i watermark.png -filter_complex "overlay=(main_w-overlay_w):(main_h-overlay_h)" watermark.mp4
This also gives you more options on where to place the watermark as well. For example, if you wanted to place the watermark in the center of the video you would use:
-filter_complex "overlay=(main_w-overlay_w/2):(main_h-overlay_h/2)"

Related

Combine images into video (with audio in background) in ffmpeg

I have a folder with 15 images and 1 audio file:
image_1.jpg, image_2.jpg, image_3.jpg ..... and music.webm
(Also resolution of images is 1440x720)
I want to combine these images into a video with audio in background.And framerate I require is 0.2 (5 second for each frame).I gave a search on Stackoverflow and I found the nearest example and tried.But it failed.
ffmpeg -f image2 -i image%03d.jpg -i music.webm output.mp4
(Actually I have very little knowledge of ffmpeg so please excuse my foolishness)
Please help me with my issue.(Also I didn't understood where in the code I have to enter framerate)
Edit:-If needed I can easily tweak with filename of images.Be free to tell me that too
How your command failed? please paste the text.
According to your image file format, the pattern should be: %3d, but not %03d
e.g.
image_%d.jpg apply to: image_1.jpg, image_2.jpg, image_3.jpg
image_%04d.jpg apply to: image_0001.jpg, image_0002.jpg ... image9999.jpg
and also , when using this "pattern sequence", MAKE SURE:
the sequence should start from xxx001.jpg, otherwise you should specify a parameter -start_index or something.
the sequence must not broken. e.g. image5.jpg, image6.jpg, (missing 7 ) image8.jpg
refer:
https://ffmpeg.org/ffmpeg-formats.html#image2-2
https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/image_sequence
Try this:
ffmpeg -r 0.2 -i image_%02d.jpg -i music.webm -vcodec libx264 -crf 25 -preset veryslow -acodec copy video.mkv
So -r specifies fps (I actually didn't try using a float value there, but try it)
-vcodec specifies video codec, -crf quality, preset the encoding speed (slower is more efficient), -acodec copy says audio should be copied.
I think that should work, give it a try. You will need to rename the images to image_01.jpg image_02...
Also have a look here: How to create a video from images with FFmpeg?

How to remove specific duration from video using ffmpeg

i've tried many ways to solve the problem, i also tried this code before
ffmpeg -i movie.mp4 -vf trim=3:8 cut.mp4
but for the result, the audio is still there but the video is gone. all i want is the video and audio both are removed.
can anyone help me how resolve this?
Use
ffmpeg -i movie.mp4 -vf "select='not(between(t,3,8))',setpts=N/FRAME_RATE/TB" -af aselect='not(between(t,3,8))',asetpts=N/SR/TB cut.mp4

FFmpeg - What muxer do i need to save an AAC audio stream

I'm developing Android application, and im using ffmpeg for conversion of files.
I want my binary file to be as slim as possible since i don't have many input formats and output formats, and my operation is quite basic.And of course not to bloat the APK.
In my program ffmpeg receives a file, and copys the audio stream (-acodec copy), the audio stream will always be aac (mp4a). What i need is to save the stream to file.
My command looks like this : ffmpeg -i {Input} -vn -acodec copy output.aac.
What muxer do i need to for muxing aac to file? I have tried flv,mp3,mov but i always get
Unable to find a suitable output format for 'output.aac', so these options are wrong.
I don't need an encoder for stream copy btw.
Side note: this command work flawlessly on full installation of ffmpeg , but I don't know which muxer it uses. If there is a way to output the muxer it uses from regular ffmpeg run, it would work too.
A common file format for AAC is BMFF/MOV/MP4/M4A. If you specify the m4a file extension, FFmpeg will take care of it for you.
ffmpeg -i {input} -vn -acodec copy output.m4a
If you just want raw AAC, you can use ADTS as a lightweight container of sorts, as Mulvya suggested.
ffmpeg -i {input} -vn -acodec copy -f adts output.aac
I had to add the -f for me to work (on FFmpeg 3.22):
ffmpeg -i {input} -vn -acodec copy -f adts output.m4a
You have to add adts to --enable-muxer when configuring ffmpeg, eg. ./configure --disable-everything (...) --enable-muxer=adts. Then you will be able to save to .aac file

How to make Video Effects by ffmpeg from command line to Node JS?

I am working on ffmpeg. I have already worked on several work for editor. But currently I need to make effect on video. I have got command line command to give effect. But I cant convert it to node Js :
cellauto: ffplay -f lavfi -i cellauto=rule=110
life: ffplay -f lavfi -i life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
So I need to converrt it in filter by node js.

Multiple fadeIn/fadeOut effects in one audio file with ffmpeg

I have some problem to add several fade effects to one audio file. When I try to use a command like this:
ffmpeg -y -i /home/user/video/test/sound.mp3 -af "afade=t=in:ss=0:d=3,afade=t=out:st=7:d=3,afade=t=in:st=10:d=3,afade=t=out:st=17:d=3,afade=t=in:st=20:d=3,afade=t=out:st=27:d=3" /tmp/test.mp3
then my output audio file has a fadein and fadeout applied only once. All the next effects don't get applied. Is there any possible way to apply several fade effects to the same audio file? Also, what is the difference between ss and st parameter in this command?
The problem is that after fading out the audio you are trying to fade in the silence.
The solution is to disable the fade out filter when you want to start fading in.
You can achieve that with Timeline Editing to enable the filters for a particular amount of time.
The following example works just fine:
ffmpeg -i input.mp3 -af "afade=enable='between(t,0,3)':t=in:ss=0:d=3,afade=enable='between(t,7,10)':t=out:st=7:d=3,afade=enable='between(t,10,13)':t=in:st=10:d=3,afade=enable='between(t,13,16)':t=out:st=13:d=3" -t 16 output.mp3
Works for me with ffmpeg 2.5.2.
I'm using fade in and fade out audio filter, both for the duration of 3 seconds.
ffmpeg -i audio.mp3 -af 'afade=t=in:ss=0:d=3,afade=t=out:st=27:d=3' out.mp3
I'd recommend to upgrade your ffmpeg, as this might be a bug. More information in the docs.
take a look here: ffmpeg volume filters
volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
complete command:
ffmpeg -i movie.wav -filter volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame modified-movie.wav

Resources