FFmpeg - combine 2 commands - ffmpeg

I have 2 commands as listed below.
Add intro image to a video
ffmpeg -y -loop 1 -framerate 10 -t 3 -i intro.png -i video.mp4 -filter_complex "[0:0] [1:0] concat=n=2:v=1:a=0" -c:v libx264 -crf 23 videoWithIntro.mp4
Add watermark to video
ffmpeg -y -i video.mp4 -i watermark_color.png -filter_complex "overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2" videoWithWatermark.mp4
I was wondering is it possible to combine these into the 1 command?

Use
ffmpeg -y -loop 1 -framerate 10 -t 3 -i intro.png -i video.mp4 -i watermark_color.png -filter_complex "[0][1]concat=n=2:v=1:a=0[v];[v][2]overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2" videoWithWatermark.mp4
I assume your videos don't have audio, else use
ffmpeg -y -loop 1 -framerate 10 -t 3 -i intro.png -i video.mp4 -i watermark_color.png -f lavfi -t 3 -i anullsrc -filter_complex "[0][1]concat=n=2:v=1:a=0[v];[v][2]overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2;[3][1]concat=n=2:v=0:a=1" videoWithWatermark.mp4

The final command to get this working correctly is as follows
ffmpeg -y -loop 1 -framerate 25 -t 3 -i 1920x1080_intro.png -i DSC_0002.MOV -i watermark_color.png -report -an -filter_complex "[1][2]overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2,setsar=1[v];[0]setsar=1[pre];[pre][v]concat=n=2:v=1:a=0" ../testing/videoWithIntroAndWatermark.mp4

Related

ffmpeg - Sync Audio with image position (Audio Slideshow)

How can i start the audio Files at the same position as the pictures? (This is for a Image slideShow with changing Audio)
ffmpeg -loop 1 -t 19 -i 1.jpg -loop 1 -t 19 -i 2.jpg -i 1.mp3 -i 2.mp3
-filter_complex "
[0:a]adelay=19s:all=1[1a];
[1:a]adelay=24s:all=1[2a];
[0:v]scale=1280:720,pad=1280:720:(ow-iw)/2:(oh-ih)/2,setsar=1[0p];
[1:v]scale=1280:720,pad=1280:720:(ow-iw)/2:(oh-ih)/2,setsar=1[1p];
[0p][1p]xfade=transition=fade:duration=1:offset=19[1x];
-map [1x] -c:v libx264 -c:a copy -t 39 out.mp4
ok i found a solution to position audio files by seconds with Images.
just use this structure
and Paramter "adelay" for an audio offset
ffmpeg -loop 1 -t 10 -i "1.jpg" -loop 1 -t 10
-i "2.jpg" -t 5 -ss 0 -i "audio1.mp3"
-t 10 -ss 10 -i "audio2.mp3"
-filter_complex "[2]adelay=1000:all=1[a1];
[3]adelay=2000:all=1[a2];
[0:v]scale=1280:720,pad=1280:720:(ow-iw)/2:(oh-ih)/2,setsar=1[0p];
[1:v]scale=1280:720,pad=1280:720:(ow-iw)/2:(oh-ih)/2,setsar=1[1p];
[0p][1p]xfade=transition=fade:duration=1:offset=5.485[1x];
[a1][a2]amix=inputs=2[aout]" -map [1x] -map [aout] _out.mp4 -y 2>&1

ffmpeg - create blank video file with multichannel audio?

i found a couple of threads on stackoverflow that allow me to create a dummy mov file for picture:
ffmpeg -f lavfi -i color=c=black:s=640x480 -c:v prores_ks -profile:v 3 -tune stillimage -pix_fmt yuv422p10 -t 10 output_proreshq.mov
the above creates a 10 second, picture-only file.
this:
ffmpeg -f lavfi -i anullsrc=channel_layout=5.1:sample_rate=48000 -t 10 output.wav
creates a 6 channel wav file.
i haven't been able to figure out how to combine these two commands to create a file with blank picture and six channels of blank audio. can someone show me how to get this done? thanks!
Combined command is:
ffmpeg -f lavfi -i color=c=black:s=640x480 -f lavfi -i anullsrc=channel_layout=5.1:sample_rate=48000 -c:v prores_ks -profile:v 3 -pix_fmt yuv422p10 -c:a pcm_s16le -t 10 output_proreshq.mov
-tune stillimage is for libx264 only and is being ignored in your command so I removed it.
As for your duration queries, all of the simplified examples below will have a 10 second duration:
ffmpeg -f lavfi -i color -f lavfi -i anullsrc -t 10 output.mov
ffmpeg -f lavfi -i color=d=10 -f lavfi -i anullsrc -shortest output.mov
ffmpeg -f lavfi -i color -t 10 -f lavfi -i anullsrc -shortest output.mov
ffmpeg -t 10 -f lavfi -i color -t 10 -f lavfi -i anullsrc output.mov
ffmpeg -f lavfi -i color,trim=duration=10 -f lavfi -i anullsrc,atrim=duration=10 output.mov
ffmpeg -f lavfi -i color,trim=duration=10 -f lavfi -i anullsrc -shortest output.mov
Use whatever method you prefer.

Combine two ffmpeg commands (segment and still photo)

is it possible to combine this command
ffmpeg -i video.mp4 -map 0:s:0? -c copy -movflags empty_moov+default_base_moof+frag_keyframe -f segment output%03d.mp4
with a command that can take a still from the first segment
ffmpeg -ss 00:00:00.00 -i output001.mp4 -vframes 1 -q:v 2 still.jpg"
Append the second command to the first:
ffmpeg -i video.mp4 -map 0:s:0? -c copy -movflags empty_moov+default_base_moof+frag_keyframe -f segment output%03d.mp4 -frames:v 1 -q:v 2 still.jpg

FFmpeg filter_complex merging two commands

I'm having trouble merging these two commands, if anyone can help me merge the top ones transposing and watermarking to the second one I would really appreciate it. I've tried a few things such as:
ffmpeg -i .\test1.flv -i .\test2.flv -loop 1 -i .\watermark.png -filter_complex "[0]transpose=1[a];[1]transpose=1[b];[a][b]hstack[c];[c][2]overlay=W-w-5:H-h-5:shortest=1; [0:v]setpts=PTS-STARTPTS, pad=iw*2:ih[bg]; [1:v]setpts=PTS-STARTPTS[fg]; amerge,pan=stereo:c0<c0+c2:c1<c1+c3" -c:v libx264 -f mp4 -threads 24 -y matt.mp4
ffmpeg -i .\test1.flv -i .\test2.flv -loop 1 -i .\watermark.png -filter_complex "[0:v]setpts=PTS-STARTPTS, pad=iw*2:ih[bg]; [1:v]setpts=PTS-STARTPTS[fg]; amerge,pan=stereo:c0<c0+c2:c1<c1+c3;[0]transpose=1[a];[1]transpose=1[b];[a][b]hstack[c];[c][2]overlay=W-w-5:H-h-5:shortest=1" -c:v libx264 -f mp4 -threads 24 -y matt.mp4
Thanks everyone!
If I understand your intent right, this is what you want
ffmpeg -i .\test1.flv -i .\test2.flv -loop 1 -i .\watermark.png -filter_complex
"[0]setpts=PTS-STARTPTS,transpose=1[a];
[1]setpts=PTS-STARTPTS,transpose=1[b];
[a][b]hstack[c];
[c][2]overlay=W-w-5:H-h-5:shortest=1[v];
[0]asetpts=PTS-STARTPTS[x];[1]asetpts=PTS-STARTPTS[y];
[x][y]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[a]"
-map "[v]" -map "[a]" -c:v libx264 -f mp4 -threads 24 -y matt.mp4

FFMPEG h264 grey frame and artifacts at beginning

I'm splitting my "zi6 quicktime mov" hd videos, I have 250 clips of around 10 or 15 seconds each, from lot of places, locationes around the globe and want to combine them in a single big clip.
I can merge them very good with "mkvmerge".
The problem is that the first frames of all videos in the collection (splitted with ffmpeg), are gray or with artifacts at beggining, I do not know how to explain, maybe wrong ffmpeg commands, I'm doing this (with batch command line, which is great / fast for me):
=======begin of batch file
ffmpeg -i jockey_club_fpv.mov -ss 00:00:17 -t 00:00:24 -g 1 -sameq -vcodec copy -vf fade=in:0:30 partes3a.mov
ffmpeg -i jockey_club_fpv.mov -ss 00:04:40 -t 00:00:20 -g 1 -sameq -vcodec copy -vf fade=in:0:30 partes3b.mov
ffmpeg -i jockey_club_fpv.mov -ss 00:05:35 -t 00:01:00 -g 1 -sameq -vcodec copy -vf fade=in:0:30 partes3c.mov
ffmpeg -i jockey_club_fpv.mov -ss 00:07:11 -t 00:00:10 -g 1 -sameq -vcodec copy -vf fade=in:0:30 partes3d.mov
ffmpeg -i jockey_club_fpv.mov -ss 00:07:45 -t 00:00:21 -g 1 -sameq -vcodec copy -vf fade=in:0:30 partes3e.mov
ffmpeg -i jockey_club_fpv.mov -ss 00:08:47 -t 00:00:05 -g 1 -sameq -vcodec copy -vf fade=in:0:30 partes3f.mov
ffmpeg -i jockey_club_fpv.mov -ss 00:09:18 -t 00:00:10 -g 1 -sameq -vcodec copy -vf fade=in:0:30 partes3g.mov
ffmpeg -i jockey_club_fpv.mov -ss 00:09:35 -t 00:00:09 -g 1 -sameq -vcodec copy -vf fade=in:0:30 partes3h.mov
ffmpeg -i jockey_club_fpv.mov -ss 00:10:07 -t 00:00:16 -g 1 -sameq -vcodec copy -vf fade=in:0:30 partes3i.mov
mkvmerge -o join4.mov partes3a.mov + partes3b.mov + partes3c.mov + partes3d.mov + partes3e.mov + partes3f.mov + partes3g.mov + partes3h.mov + partes3i.mov
=======end of batch file
Thanks a lot for any answer!!

Resources