1

The Original video resolution is 720:1280 and I want to:

  1. copy the original video, scale to 1080:1080 and blur.
  2. again copy the original video and scale to 608:1080.
  3. Finally move blurred to 1080:1080 box and move second(608:1080) scaled copy above the blurred copy.

Structure:

Box(1080:1080)
  Blurred(Original -> 1080:1080 -> Blur)
  Scaled(Original -> 608:1080)

ffmpeg command:

ffmpeg -i tmpVideo.mp4 -vf -filter_complex \
"split[main][copy]; \
[main]scale=1080:1080[container]; \
[copy]scale=-1:1080,split[content, copy1]; \
[copy1]gblur=sigma=20[blurred]; \
[container][blurred]overlay=0:0[mix]; \
[mix][content]overlay=W/2:0" \
output.mp4

The error I'm getting:

Unable to find a suitable output format for 'split[main][copy]; [main]scale=1080:1080[container]; [copy]scale=-1:1080,split[content, copy1]; [copy1]gblur=sigma=20[blurred]; [container][blurred]overlay=0:0[mix]; [mix][content]overlay=W/2:0'
split[main][copy]; [main]scale=1080:1080[container]; [copy]scale=-1:1080,split[content, copy1]; [copy1]gblur=sigma=20[blurred]; [container][blurred]overlay=0:0[mix]; [mix][content]overlay=W/2:0: Invalid argument

How should I proceed?

  • An edit and an upvote! ;-) – Fabby May 27 '19 at 9:19
1

You're missing the input to the filtergraph, for example 0:v. There are other issues though, so this is what works for me:

ffmpeg -i VID_20190619_205627.mp4 -filter_complex \
"[0:v]scale=1080:1080,setdar=1:1,gblur=sigma=20[bg]; \
[0:v]scale=-1:1080[ov]; \
[bg][ov]overlay=(W-w)/2:0[mix]" \
-map [mix] -r 25 out.mp4 -y
  • the first chain of the filtergraph scales the input video to 1080 x 1080, forces the display aspect ratio to 1:1 and blurs the video. This is the background (bg)
  • the second chain takes the input video again and scales it to ? x 1080. This is the video that will be overlaid (ov)
  • the last chain overlays the scaled video (ov) on the blurred background (bg), and produced the output (mix), which is then chosen as the output with -map.

Note that the blurred background is stretched in this way.

Depending on the type of input, you might want to force the frame rate with -r 25 or similar, and to copy the audio track with -map 0:a -c:a copy.

| improve this answer | |
0

Solved with 5 separated commands:

ffmpeg -i tmpVideo.mp4 scale=1080:1080 container.mp4
ffmpeg -i container.mp4 gblur=sigma=20 blurred.mp4
ffmpeg -i tmpVideo.mp4 scale=-1:1080 content.mp4
ffmpeg -i container.mp4 -i blurred.mp4 -filter_complex "[0:v][1:v]overlay=0:0" mix.mp4
ffmpeg -i mix.mp4 -i content.mp4 -filter_complex "[0:v][1:v]overlay=(W-w)/2:0" output.mp4
| improve this answer | |
  • 1
    Are you sure that your first 3 commands are correct without something as -vf? – MarianD Jun 8 '19 at 5:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.