Can not add images after add background to audio - ffmpeg

I use below command to concat background to an audio file:
"ffmpeg" -i /path/to/image.png -i /path/to/audio.mp3 -vsync vfr -pix_fmt yuv420p /path/to/video-1.mp4 2>&1
Next, I use that command to add other images to created video:
"ffmpeg" -f concat -safe 0 -i /path/to/text.txt -i /path/to/video-1.mp4 /path/to/video-2.mp4 2>&1
Content of my text.txt file:
/path/to/img1.jpg
duration 6
/path/to/img2.jpg
duration 6
/path/to/img3.jpg
duration 6
/path/to/img4.jpg
duration 6
Obtained video display only background image. Other images have not been shown.
What are my wrong in these commands? And how to set the display position of other images in video? To display images by position, I use below command, but after it ran, my machine was crashed:
"ffmpeg" -f concat -safe 0 -i /path/to/text.txt -i /path/to/video-1.mp4 -filter_complex "overlay=0:0, scale=640:640" /path/to/video-2.mp4 2>&1
Update:
I do follow order by below steps and got video with text and images, but the position is incorrect. I can't find any solution for custom:
"ffmpeg" -f concat -safe 0 -i /path/to/text.txt -i /path/to/audio.mp3 -vsync vfr -pix_fmt yuv420p /path/to/tmp-video-1.mp4 2>&1
"ffmpeg" -i /path/to/background.png -i /path/to/tmp-video-1.mp4 -filter_complex "overlay=0:0" /path/to/tmp-video-2.mp4 2>&1
"ffmpeg" -i /path/to/tmp-video-2.mp4 -vf "[in]<define texts and duration>[out]" -codec:a copy /path/to/endvideo.mp4 2>&1
Please take a look my video: http://184.171.170.45/cron/tmp/funny-1489648654.mp4
I tried to set overlay property in second command: -640:0, let images in horizontal center of background, but its not working

Related

I want to pipe these two ffmpeg commands for to convert a video to grayscale frames

Please, I want to pipe these two commands.
ffmpeg -i input.flv -vf fps=1 out%d.png | ffmpeg -i input -vf format=gray output
If you just need frames, try this:
ffmpeg -i input.flv -r 1 -pix_fmt gray out%d.png
There is no need to call it twice
-r sets the output frame rate (1 frame/sec) dropping excess frames
pix_fmt sets the output pixel format
[edit]
Try this to output both grayscale video and images:
ffmpeg -i input.flv \
-filter_complex format=gray,split[v0][v1]
-map [v0] -r 1 out%d.png
-map [v1] output.mp4

FFmpeg slideshow concat outputs only the last image

I'am trying to produce image slideshow by ffmpeg concat.
The problem is that the output video only plays the last image from my input file with images.
The input:
file '/var/www/html/docroot/types/video/images/img0.jpg'
duration 10
file '/var/www/html/docroot/types/video/images/img1.jpg'
duration 10
file '/var/www/html/docroot/types/video/images/img2.jpg'
duration 10
The command:
ffmpeg -y -r 1/10 -f concat -safe 0 -i /var/www/html/docroot/types/video/info.txt -c:v libx264 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2,fps=30,format=yuv420p" /var/www/html/docroot/types/video/output.mp4
And in the output I have something like this:
GIF
Remove -r 1/10 and ,fps=30:
ffmpeg -y -f concat -safe 0 -i /var/www/html/docroot/types/video/info.txt -c:v libx264 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2,format=yuv420p" /var/www/html/docroot/types/video/output.mp4

How do we redirect the output of 1 ffmpeg processing as input in the same command?

I want to attach 2 videos using hstack filter and this is what I am doing, resizing 1 of the video files (to match same height) and then proceeding to merge. This is happening as 2 different steps,
ffmpeg -y -i inputVideo1 -vf scale=-2:900 outputVideo1
ffmpeg -y -i outputVideo1 -i inputVideo2 -c:v libx264 -filter_complex hstack outputVideo2.mp4
This is taking longer time. How do I make this happen in a single step? Something like,
ffmpeg -i inputVideo1 (something here) outputVideo1 (take this as input) -i inputVideo2 (hstack and stuff) outputVideo2.mp4```
Combined command:
ffmpeg -i inputVideo1 -i inputVideo2 -c:v libx264 -filter_complex "[0:v]scale=-2:900[left];[left][1:v]hstack" outputVideo.mp4

FFmpeg | Option loop not found

The loop option is not working with gif image.
When I'm working with png image the code good.
But when I'm working with animated gif image the error is thrown Option loop not found.
In my example I'm trying to create the video from input image with specific duration.
ffmpeg -loop 1 -t 5 -i 15324210315b56e3a78abe5.png -i watermark.png -filter_complex "[0]scale=trunc(iw/2)*2:trunc(ih/2)*2[v];[v][1]overlay=x=(W-w-10):y=(H-h-10)" output.mp4
Below command is not working
ffmpeg -loop 1 -t 5 -i 15323488345b55c9a2b2908.gif -i watermark.png -filter_complex "[0]scale=trunc(iw/2)*2:trunc(ih/2)*2[v];[v][1]overlay=x=(W-w-10):y=(H-h-10)" output.mp4
GIFs are handled by a seperate demuxer module, not the generic image sequence demuxer. The gif demuxer has a separate option. See command below.
ffmpeg -ignore_loop 0 -t 5 -i 15323488345b55c9a2b2908.gif ...
The python script for gif to video conversion using ffmpeg library
f"/opt/ffmpeglib/ffmpeg -ignore_loop 0 -i {lambda_file_path} -c:v libx264 -t 10 -pix_fmt yuv420p {lambda_output_file_path}

Ffmpeg video overlay

I am trying to create a video output from multiple video cameras.
Following the example given here Presenting more than 2 videos using FFmpeg
and other similar examples.
but Im getting the error
Output pad "default" for the filter "src" of type "buffer" not connected to any destination
when i run
ffmpeg -i /dev/video1 -i /dev/video0 -filter_complex "[0:0]pad=iw*2:ih[a];[a][1:0]overlay=w[b];[b][2:0]overlay=w:h" -shortest output.mp4
Im not really sure what this means or how to fix it.
Any help would be greatly appreciated!
Thanks.
When using the "padding" option, you have to specify which is the size of the output image and where you want to put the input image
[0:0]pad=iw*2:ih:0:0
tested under windows 7 with file of same size
ffmpeg -i out.avi -i out.avi -filter_complex "[0:0]pad=iw*2:ih:0:0[a];[a][1:0]overlay=w" -shortest output.mp4
and with WebCam Cap (vfwcap) and a still picture (as i have only o=1 WebCam). BTW you can see how to scale one the source to fit in the target (just in case your source have different resolution)
ffmpeg -y -f vfwcap -r 10 -i 0 -loop 1 -i photo.jpg -filter_complex "[0:0]pad=iw*2:ih:0:0[a];[1:0]scale=640:480[b];[a][b]overlay=w" -shortest output.mp4
under Linux:
ffmpeg -i /dev/video1 -i /dev/video0 -filter_complex "[0:0]pad=iw*2:ih:0:0[[a];a][1:0]overlay=w" -shortest output.mp4
if it doesn't work test a simple record of video 1 and after of video 0 and check their properties (type, resolution, fps).
ffmpeg -i /dev/video1 -shortest output1.mp4
ffmpeg -I output1.mp4
If you still have issue, update your question with ffmpeg console output (as text) for video and video 0 capture and also of the call with the overlay

Resources