Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US :: FAQ
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
FORUMS:listlist (w/ descriptions)archivetagssearchhall of famerecent posts

ffmpeg scaling issue

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook
Jack Passmoreffmpeg scaling issue
by on Sep 29, 2010 at 6:43:29 pm

Hi all,

I'm trying to convert a large 1920x1080 .avi file (8-bit mjpeg Blackmagic codec) to an h246 encoded mp4 file using ffmpeg at the command line. The 1920x1080 original image is a pillar-boxed 4:3 image, so I'm trying to crop the sides off to eventually create a 640x480, 4:3, H264, .mp4 video.

The problem is, when I use ffmpeg, I can successfully crop the sides, but the .mp4 output is only the top left corner (640x480) of the original 1920x1080 video. I want to crop the original video and then scale the cropped 4:3 video (1440x1080) down to 640x480. Any suggestions? This is the ffmpeg code I'm using:

ffmpeg -i videos.avi -cropleft 240 -cropright 240 -vcodec libx264 -vpre normal video.mp4

John


Return to posts index
Reply   Like  

Michael RampeRe: ffmpeg scaling issue
by on Sep 29, 2010 at 8:50:45 pm

I am not sure why you are getting a 640x480 output at all without using the size flag (-s).

What version are you using? In the newer SVN versions, libavfilter is a better option for cropping and scaling (-vf).

Please post full output and I can work on a string to suit.

Michael


Return to posts index
Reply   Like  

Jack PassmoreRe: ffmpeg scaling issue
by on Sep 30, 2010 at 9:31:54 pm

Hi Michael,

You are correct I wasn't getting a 640x480 image, I must have left that out. I was unaware of the -vf command, so thank you. However, I'm still having some problems.

This command will change the 1920x1080 letterboxed video to a 1140x1080 4:3 video correctly:

ffmpeg -i video.avi -vf "crop=240:0:1440:1080" video_crop.mp4

But when go back to the original file and try to also scale the image, it creates a 640x480 image that is stretched vertically and letterboxed:

ffmpeg -i video.avi -vf "crop=240:0:1440:1080" -vf "scale=640:480" video_crop_resize.mp4

I can't figure out why I'm not getting a 4:3 630x480 video file without letterboxing...


Return to posts index
Reply   Like  


Michael RampeRe: ffmpeg scaling issue
by on Oct 1, 2010 at 1:57:57 am

[Jack Passmore] "
ffmpeg -i video.avi -vf "crop=240:0:1440:1080" -vf "scale=640:480" video_crop_resize.mp4
I can't figure out why I'm not getting a 4:3 630x480 video file without letterboxing..."


[Jack Passmore] "This command will change the 1920x1080 letterboxed video to a 1140x1080 4:3 video correctly:
ffmpeg -i video.avi -vf "crop=240:0:1440:1080" video_crop.mp4"


(careful with number typos, it can get very confusing;-)


Your command line will only use the last instance of -vf as it is only meant to be specified once per input.

The correct usage of -vf is comma separated commands with branches separated by semi-colons.

In your case (no branches):
ffmpeg -i video.avi -vf "crop=240:0:1440:1080,scale=640:480" video_crop_resize2.mp4



BONUS TIP:
...using libavfilter for a watermark (with a branch):
(bug1.tif=50x100 file saved with transparency from p-shop)

Using SoC libavfilter [1.20. 0]
-vf "movie=0:tiff:bug1.tif [watermark];\
[in] [watermark]overlay=1600:700:1[out]"


or the hack using SVN libavfilter [1.39. 0] if you get an error with the overlay:
-vf "movie=0:tiff:logo5.tif,pad=1920:1080:1600:700:0x00000000 [watermark];\
[in] [watermark]overlay=0:0:1[out]"


...and it works with multiple separate or nested branches as well.

Michael


Return to posts index
Reply   Like  

Jack PassmoreRe: ffmpeg scaling issue
by on Oct 1, 2010 at 3:12:37 pm

Awesome, it works. Apologies for my typos! Now I just have to find the correct h264 presets for decent web viewing.
Cheers,
John


Return to posts index
Reply   Like  

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook


FORUMSTUTORIALSFEATURESVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2014 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]