Matt Wall
Matt Wall

Reputation: 505

Speeding Up FFmpeg Commands

Hey there I wanted to know if anyone can help me figure out how to group these into a single command if possible:

Invoke-Expression -Command "ffmpeg -i $filename_1_full -vf `"transpose=1`" -f mp4 $temp_flip_name_1"
Invoke-Expression -Command "ffmpeg -i $filename_2_full -vf `"transpose=1`" -f mp4 $temp_flip_name_2"
Invoke-Expression -Command "ffmpeg -i $temp_flip_name_1 -i $temp_flip_name_2 -filter_complex `"[0:v:0]pad=iw*2:ih[bg]; [bg][1:v:0]overlay=w`" -f mp4 $temp_water_name_3"
Invoke-Expression -Command "ffmpeg -i $temp_water_name_3 -vf `"movie=watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-5:main_h-overlay_h-5 [out]`" -c:v libx264 -f mp4 -y $filename_3_full"

I'm not too familiar with grouping commands and stuff with Windows and FFmpeg however trying to merge the last two, for example, complained I cannot do both at the same time.

Upvotes: 1

Views: 161

Answers (1)

Gyan
Gyan

Reputation: 93028

Use

ffmpeg -i $filename_1_full -i $filename_2_full -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"
       -c:v libx264 -f mp4 -y $filename_3_full

The hstack filter is from Aug 2015, and it obviates the need for padding and overlay.

Upvotes: 1

Related Questions