Reputation: 12574
My input video is of dimension 720x1280. The output I am getting from the command below is 1920x1080.
The problem that I am facing is, a good 720p video is losing its quality and the output video is deteriorated.
ffmpeg -i inter.mpg -filter_complex "[0]scale=hd1080,setsar=1,boxblur=20:20[b]; [0]scale=-1:1080[v];[b][v]overlay=(W-w)/2" inter_1920x1080.mpg
I am ok to scale up my video size to match the 1280 height if downsizing the height is causing the issue. But, is there a way to add custom value to the 'scale'?
Ref: I have referred to this answer from Gyan.
I tried with the following command now-
ffmpeg -i 6691602248444677381.mp4 -c:v -filter_complex "[0]scale=hd1080,setsar=1,boxblur=20:20[b]; [0]scale=-1:1080[v];[b][v]overlay=(W-w)/2" -b:v 800k output.mp4
I am getting the following error -
[NULL @ 0x7fa2af800000] Unable to find a suitable output format for '[0]scale=hd1080,setsar=1,boxblur=20:20[b]; [0]scale=-1:1080[v];[b][v]overlay=(W-w)/2'
[0]scale=hd1080,setsar=1,boxblur=20:20[b]; [0]scale=-1:1080[v];[b][v]overlay=(W-w)/2: Invalid argument
Upvotes: 2
Views: 1932
Reputation: 133813
.mpg
quality is badYou are using the encoder mpeg1video, the default for .mpg
, which outputs a very old, legacy format (MPEG-1 Video). The default bitrate value for this ancient encoder is not sufficient for modern sized videos. If this is the format that you want then add the output option -q:v 3
. Increase the value for less quality. Or choose a bitrate such as -b:v 8000k
(that's just an arbitrary bitrate value for demonstration purposes).
If MPEG-1 is not the format you want then use the -c:v
option to choose your desired encoder, and/or change the output container format (such as .mkv
or .mp4
).
Example:
ffmpeg -i inter.mpg -filter_complex "[0]scale=hd1080,setsar=1,boxblur=20:20[b]; [0]scale=-1:1080[v];[b][v]overlay=(W-w)/2" -c:v mpeg2video -q:v 3 inter_1920x1080.mpg
[0]scale=hd1080...
You added -c:v
but did not provide an actual value, so it is assuming your filtergraph is the name of the encoder you want to use. A correct example is -c:v libx264
.
You are now using .mp4
so just omit -c:v
because it will choose a sane default encoder which will be libx264. This encoder outputs H.264 video.
libx264 also has a sane bitrate default, so remove -b:v 800k
.
Your command should now look like:
ffmpeg -i 6691602248444677381.mp4 -filter_complex "[0]scale=hd1080,setsar=1,boxblur=20:20[b]; [0]scale=-1:1080[v];[b][v]overlay=(W-w)/2" output.mp4
Upvotes: 2