You can apply a certain algorithm with flags= ffmpeg -i input.mp4 -vf scale=2560:1440:flags=lanczos output.mp4 The image above edited from compares the scaling algorithm methods. The default is bicubic, with lanczos being very popular. However, this link here from user slhck gives a good run down for image/video algorithms. This is a very complex methodology, more than a few sentences can fully explain. The most complex of them all, specifying what video scaling algorithm to use when scaling. You can read more about the encoding options here and here. Scale a video and also encode or compress it at the same time: ffmpeg -i input.mp4 -vf scale=3840:2560 -c:v libx264 -preset fast -crf 22 output.mp4 So if it was a video of 16:9 ratio then output.mp4 will be 1280×720. This sets the width of the video as 1280 and then will automatically calculate the height keeping with the ratio of the input video. If you want to scale a video to a custom width but keep the ratio you can input -1 after the width: ffmpeg -i input.mp4 -vf scale=1280:-1 output.mp4 Make a video half its original size: ffmpeg -i input.mp4 -vf scale=iw/2:ih/2 output.mp4 Scaling by resolution with the ratio To double a videos resolution: ffmpeg -i input.mp4 -vf scale=iw*2:ih*2 output.mp4 To scale the video file by “times its self” such as twice as large or twice as small you can use variables * or / along with iw and ih to specify the input width and input height respectively. This will upscale input.mp4 to be 4k resolution. If you know the desired resolution, simply setting the specific width and height for scaling with the scale flag: ffmpeg -i input.mp4 -vf scale=3840:2560 output4k.mp4 There is no flag or parameter to do either upscaling or downscaling rather this is determined by the values set for the scale flag. Or an advanced scale with flags and encoding: ffmpeg -i input.mp4 -vf scale=2560x1440:flags=lanczos -c:v libx264 -preset slow -crf 20 output_compress_1440p.mp4 The basis of scaling a video with FFmpeg uses the scale flag after the filtergraph ( -vf), then you can either do basic video scaling such as upscaling the video to twice the original resolution: ffmpeg -i input.mp4 -vf scale=iw*2:ih*2 output.mp4 Scaling a video means to make it either larger (higher resolution) or smaller (smaller resolution). Good luck.How to do video scaling using FFmpeg with examples for different types of upscaling and downscaling methods. You can try with and without deinterlacing to see what works best. Mencoder filename.vob -oac mp3lame -lameopts cbr:br=128:vol=9 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2000:autoaspect -vf crop=XXX:XXX:X:X:pp=lb -ffourcc DX50 -o filename.avi To encode the entire vob file with deinterlacing: You should crop enough to remove all black borders.Īlso, since this is an old TV show, you might want to add "lb" to the video filters to deinterlace. The width and height should be multiples of 16. Once you have the crop where you like, plug those numbers into mencoder and test encode another small section of video. You can adjust the numbers a little to move the rectangle where you like. It will display a rectangle overlay on the video to show where the crop is. Using the crop values XXX:XXX:X:X from mencoder. Mplayer -vf rectangle XXX:XXX:X:X filename.vob If "cropdetect" doesn't give you good crop values, you can manually crop. Play this test file to see if you like the audio, video quality, and if it is cropped in the right location: It will create the 30 second divx5-compatible avi file "filename.avi", with 2000 kbps video, 128 kbps mp3 audio, with audio level raised to 9 (from 1-10 allowed). The above command will encode 30 seconds of video starting 10 minutes into the vob file "filename.vob". Mencoder filename.vob -oac mp3lame -lameopts cbr:br=128:vol=9 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2000:autoaspect -vf crop=XXX:XXX:X:X -ffourcc DX50 -ss 00:10:00 -endpos 00:00:30 -o filename.avi Kill it with ctrl+c, then enter the crop values XXX:XXX:X:X that it gives: Mencoder filename.vob -oac mp3lame -lameopts cbr:br=128:vol=9 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=2000:autoaspect -vf cropdetect -ffourcc DX50 -ss 00:10:00 -endpos 00:00:30 -o filename.avi This command will give recommended crop as numbers scrolling down the terminal:
0 Comments
Leave a Reply. |