Forcing format, crop and aspect ratio
I've been Googling questions in order to understand some basic parameter settings and I haven't been able to find a clear answer. (Actually, some more advanced settings make sense to me thanks to the link provided by Stefano Sabatini http://thread.gmane.org/gmane.comp.video.ffmpeg.user/16235/focus=16283 ) I am deciding between a few different scenarios. My problems are as follows. With a Player screen size at 576 x 432, which is 4:3, I will have source video uploaded in different aspect ratios. 1. If I use -s 576x432 will that force it? What will happen if I use the -s but I don't use the -aspect parameter? 2. If I use -aspect 4:3, what will happen to a source video file with a 16:9 aspect ratio? Will it automatically scale to 576 x 324 (16:9) because 576 is the defining dimension? 3. What if I want the screen size to be 576 x 432, regardless of the source aspect ratio, but I want both 16:9 and 4:3 sizes to fully fit in the 4:3 screen. Do I cropleft and cropright for the 16:9, but leave the 4:3? I want the ouput to show the "middle" of 16:9 and the 4:3. Can both be done? Regards, Steve _________________________________________________________________ See what people are saying about Windows Live. Check out featured posts. http://www.windowslive.com/connect?ocid=TXT_TAGLM_WL_connect2_082008
On Mon, 2008-09-01 at 07:18 +0000, Steve R. Bennen wrote:
I've been Googling questions in order to understand some basic parameter settings and I haven't been able to find a clear answer. (Actually, some more advanced settings make sense to me thanks to the link provided by Stefano Sabatini http://thread.gmane.org/gmane.comp.video.ffmpeg.user/16235/focus=16283 ) I am deciding between a few different scenarios. My problems are as follows. With a Player screen size at 576 x 432, which is 4:3, I will have source video uploaded in different aspect ratios.
1. If I use -s 576x432 will that force it? What will happen if I use the -s but I don't use the -aspect parameter? 2. If I use -aspect 4:3, what will happen to a source video file with a 16:9 aspect ratio? Will it automatically scale to 576 x 324 (16:9) because 576 is the defining dimension? 3. What if I want the screen size to be 576 x 432, regardless of the source aspect ratio, but I want both 16:9 and 4:3 sizes to fully fit in the 4:3 screen. Do I cropleft and cropright for the 16:9, but leave the 4:3? I want the ouput to show the "middle" of 16:9 and the 4:3. Can both be done?
What I do is test if its 16x9 and then --padtop 60 --padbottom 60 and it will add the black bars top and bottom for you and make it look correct.
From: lennon at orcon.net.nz To: ffmpeg-user at mplayerhq.hu Date: Mon, 1 Sep 2008 19:23:05 +1200 Subject: Re: [FFmpeg-user] Forcing format, crop and aspect ratio
On Mon, 2008-09-01 at 07:18 +0000, Steve R. Bennen wrote:
I've been Googling questions in order to understand some basic parameter settings and I haven't been able to find a clear answer. (Actually, some more advanced settings make sense to me thanks to the link provided by Stefano Sabatini http://thread.gmane.org/gmane.comp.video.ffmpeg.user/16235/focus=16283 ) I am deciding between a few different scenarios. My problems are as follows. With a Player screen size at 576 x 432, which is 4:3, I will have source video uploaded in different aspect ratios.
1. If I use -s 576x432 will that force it? What will happen if I use the -s but I don't use the -aspect parameter? 2. If I use -aspect 4:3, what will happen to a source video file with a 16:9 aspect ratio? Will it automatically scale to 576 x 324 (16:9) because 576 is the defining dimension? 3. What if I want the screen size to be 576 x 432, regardless of the source aspect ratio, but I want both 16:9 and 4:3 sizes to fully fit in the 4:3 screen. Do I cropleft and cropright for the 16:9, but leave the 4:3? I want the ouput to show the "middle" of 16:9 and the 4:3. Can both be done?
What I do is test if its 16x9 and then --padtop 60 --padbottom 60 and it will add the black bars top and bottom for you and make it look correct.
Thanks, Craig, but I will have user-generated videos of all different sizes and aspect ratios being uploaded for encoding. If I knew it was 16x9, I would definitely try your suggestion. I am trying to understand how FFmpeg handles different variations. My first two questions may be asking the same question in different ways, but the third question is unique, I believe. Correct? _______________________________________________
ffmpeg-user mailing list ffmpeg-user at mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
_________________________________________________________________ Get thousands of games on your PC, your mobile phone, and the web with Windows?. http://clk.atdmt.com/MRT/go/108588800/direct/01/
Steve R. Bennen wrote:
I've been Googling questions in order to understand some basic parameter settings and I haven't been able to find a clear answer. (Actually, some more advanced settings make sense to me thanks to the link provided by Stefano Sabatini http://thread.gmane.org/gmane.comp.video.ffmpeg.user/16235/focus=16283 ) I am deciding between a few different scenarios. My problems are as follows. With a Player screen size at 576 x 432, which is 4:3, I will have source video uploaded in different aspect ratios.
1. If I use -s 576x432 will that force it? What will happen if I use the -s but I don't use the -aspect parameter? 2. If I use -aspect 4:3, what will happen to a source video file with a 16:9 aspect ratio? Will it automatically scale to 576 x 324 (16:9) because 576 is the defining dimension? 3. What if I want the screen size to be 576 x 432, regardless of the source aspect ratio, but I want both 16:9 and 4:3 sizes to fully fit in the 4:3 screen. Do I cropleft and cropright for the 16:9, but leave the 4:3? I want the ouput to show the "middle" of 16:9 and the 4:3. Can both be done?
From my understanding, the -aspect command line option only sets a flag in some containers (mpeg for sure, possibly others), whose end result is to stretch the video when it's being viewed to a given aspect ratio.
The -s option specifies the size of the video frames, and it ignores aspect ratios of the source video and the -aspect option. You'll have to calculate the video size beforehand and pass the exact value to -s. Concerning the -aspect flag, unless you are sure your container format supports is properly, I'd recommend not using it (that is, using a 1:1 aspect ratio) and resizing the video to a proper size, possibly adding black bars with -padtop and -padbottom. You'll have to calculate the size of the video and the bars manually, however. -- ''', o_)O \)____)" \_ ) woof! '',,,,,, || || "--'"--' Eduardo M KALINOWSKI eduardo at kalinowski.com.br http://move.to/hpkb
Date: Mon, 1 Sep 2008 08:35:01 -0300 From: eduardo at kalinowski.com.br To: ffmpeg-user at mplayerhq.hu Subject: Re: [FFmpeg-user] Forcing format, crop and aspect ratio
Steve R. Bennen wrote:
I've been Googling questions in order to understand some basic parameter settings and I haven't been able to find a clear answer. (Actually, some more advanced settings make sense to me thanks to the link provided by Stefano Sabatini http://thread.gmane.org/gmane.comp.video.ffmpeg.user/16235/focus=16283 ) I am deciding between a few different scenarios. My problems are as follows. With a Player screen size at 576 x 432, which is 4:3, I will have source video uploaded in different aspect ratios.
1. If I use -s 576x432 will that force it? What will happen if I use the -s but I don't use the -aspect parameter? 2. If I use -aspect 4:3, what will happen to a source video file with a 16:9 aspect ratio? Will it automatically scale to 576 x 324 (16:9) because 576 is the defining dimension? 3. What if I want the screen size to be 576 x 432, regardless of the source aspect ratio, but I want both 16:9 and 4:3 sizes to fully fit in the 4:3 screen. Do I cropleft and cropright for the 16:9, but leave the 4:3? I want the ouput to show the "middle" of 16:9 and the 4:3. Can both be done?
From my understanding, the -aspect command line option only sets a flag in some containers (mpeg for sure, possibly others), whose end result is to stretch the video when it's being viewed to a given aspect ratio.
The -s option specifies the size of the video frames, and it ignores aspect ratios of the source video and the -aspect option. You'll have to calculate the video size beforehand and pass the exact value to -s.
Concerning the -aspect flag, unless you are sure your container format supports is properly, I'd recommend not using it (that is, using a 1:1 aspect ratio) and resizing the video to a proper size, possibly adding black bars with -padtop and -padbottom. You'll have to calculate the size of the video and the bars manually, however.
Ok, I'm still confused, but I'm starting to understand. The main problem is that I will have user-generated source files with different and unknown sizes and aspect ratios uploaded for encoding. For example, imagine your Youtube and your need to allow users the ability to upload video with different formats, sizes and aspect ratios to be encoded and played back in a fixed player and screen size. That size is 576x432 (4:3). How do I accommodate all possibilities in the encoding string?
Eduardo M KALINOWSKI eduardo at kalinowski.com.br http://move.to/hpkb
_______________________________________________ ffmpeg-user mailing list ffmpeg-user at mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
_________________________________________________________________ See what people are saying about Windows Live. Check out featured posts. http://www.windowslive.com/connect?ocid=TXT_TAGLM_WL_connect2_082008
Steve R. Bennen escreveu:
Ok, I'm still confused, but I'm starting to understand. The main problem is that I will have user-generated source files with different and unknown sizes and aspect ratios uploaded for encoding. For example, imagine your Youtube and your need to allow users the ability to upload video with different formats, sizes and aspect ratios to be encoded and played back in a fixed player and screen size. That size is 576x432 (4:3).
How do I accommodate all possibilities in the encoding string?
You'll need to write a script that grabs the size of the original video (using ffmpeg -i or ffprobe), does the math to calculate what size the resulting video needs to be to fit in the maximum size you want, preserving the aspect ratio, and based on that size calculates the size of black borders that need to be added. With all that, the script calls ffmpeg with the right parameters. -- Eduardo M Kalinowski eduardo at kalinowski.com.br
participants (3)
-
eduardo@kalinowski.com.br -
lennon@orcon.net.nz -
sbmmm@hotmail.com