Resize video with same aspect ratio
Hello I try to create a script, which automatically generates 3gp files from flv files. Can ffmpeg analyze, if the source-video is 4:3 or 16:9 in a first step, so that I can create the video in a second step with the correct target format? Or is there a other tool, which I have to use for analyze the source- file? For example. if source is 320x240 (4:3) then ffmpeg -i input.flv -f 3gp -vcodec h264 -b 100 -s 176x132 -acodec libfaac -ab 32k -ar 22050 -ac 1 output.3gp else (16:9) ffmpeg -i input.flv -f 3gp -vcodec h264 -b 100 -s 176x100 -acodec libfaac -ab 32k -ar 22050 -ac 1 output.3gp All will work on OS X. I will try to do it with a shell script, or if not possible with a c-command line utility. Regards, Oliver
-----Original Message----- From: ffmpeg-user-bounces at mplayerhq.hu [mailto:ffmpeg-user-bounces at mplayerhq.hu] On Behalf Of Oliver Brodwolf Sent: Tuesday, June 30, 2009 11:18 AM To: ffmpeg-user at mplayerhq.hu Subject: [FFmpeg-user] Resize video with same aspect ratio Hello I try to create a script, which automatically generates 3gp files from flv files. Can ffmpeg analyze, if the source-video is 4:3 or 16:9 in a first step, so that I can create the video in a second step with the correct target format? Or is there a other tool, which I have to use for analyze the source- file? -----Original Message----- This has been an oft requested feature in FFMPEG for years with no luck. It's always "in the works", but never actually gets implemented. :)
* Oliver Brodwolf on Tuesday, June 30, 2009 at 18:17:48 +0200
I try to create a script, which automatically generates 3gp files from flv files. Can ffmpeg analyze, if the source-video is 4:3 or 16:9 in a first step, so that I can create the video in a second step with the correct target format?
ffmpeg -i input.flv 2>&1 | sed -e '/DAR/!d; s/^.*DAR \([0-9]*:[0-9]*\).*/\1/' should give you the display aspect ratio of input.flv.
Or is there a other tool, which I have to use for analyze the source-file?
You don't have to for this purpose, but there are. mediainfo mplayer -vo null -ao null -frames 0 -identify input.flv ffprobe
For example.
if source is 320x240 (4:3) then ffmpeg -i input.flv -f 3gp -vcodec h264 -b 100 -s 176x132 -acodec libfaac -ab 32k -ar 22050 -ac 1 output.3gp else (16:9) ffmpeg -i input.flv -f 3gp -vcodec h264 -b 100 -s 176x100 -acodec libfaac -ab 32k -ar 22050 -ac 1 output.3gp
All will work on OS X. I will try to do it with a shell script, or if not possible with a c-command line utility.
What is a c-command line, or a c-command line utility for that matter? c -- Was hei?t hier Dogma, ich bin Underdogma! [ What the hell do you mean dogma, I am underdogma. ] _F R E E_ _V I D E O S_ http://www.blacktrash.org/underdogma/ http://www.blacktrash.org/underdogma/index-en.html
* Christian Ebert on Tuesday, June 30, 2009 at 22:44:55 +0200
* Oliver Brodwolf on Tuesday, June 30, 2009 at 18:17:48 +0200
I try to create a script, which automatically generates 3gp files from flv files. Can ffmpeg analyze, if the source-video is 4:3 or 16:9 in a first step, so that I can create the video in a second step with the correct target format?
ffmpeg -i input.flv 2>&1 | sed -e '/DAR/!d; s/^.*DAR \([0-9]*:[0-9]*\).*/\1/'
should give you the display aspect ratio of input.flv.
Sorry, no, it doesn't for flv afaics. Bugger. Ah, wait, this monster works for flv; it outputs 1.333 for 4:3 and 1.777 for 16:9 : ffmpeg -i input.flv 2>&1 | \ sed -e '/Video: flv/!d; s/.* \([0-9]*\)x\([0-9]*\).*/scale=3;\1\/\2/' | bc Tested this time! c -- Was hei?t hier Dogma, ich bin Underdogma! [ What the hell do you mean dogma, I am underdogma. ] _F R E E_ _V I D E O S_ http://www.blacktrash.org/underdogma/ http://www.blacktrash.org/underdogma/index-en.html
What is a c-command line, or a c-command line utility for that matter What I need is a tool, which watch about a big folder-structure, and if there are new flv-files, then create the 3gp files in a parallel folder-structure. And for this I can create an apple-script ore a perhaps I have to create a little program written in Xcode. Then call this program
Hello Cristian Great idea. First it didn't work, because I used an older ffmpeg version. The returned text from ffmpeg was: Input #0, flv, from 'input.flv': Duration-61 start-0.000000 bitrate-48 0.0,,,,,Video,flv,yuv420p,420,314,15.00 0.1,,,,,Audio,mp3,44100,1,48 Then I compiled the actual ffmpeg version. The result: Input #0, flv, from 'input.flv': Duration: 00:01:01.40, start: 0.000000, bitrate: N/A Stream #0.0: Video: flv, yuv420p, 420x314, 15 tbr, 1k tbn, 1k tbc Stream #0.1: Audio: mp3, 44100 Hz, 1 channels, s16 and after this your regex did work. Am 30.06.2009 um 22:44 schrieb Christian Ebert: periodical. Regards, Oliver Am 30.06.2009 um 23:05 schrieb Christian Ebert:
* Christian Ebert on Tuesday, June 30, 2009 at 22:44:55 +0200
* Oliver Brodwolf on Tuesday, June 30, 2009 at 18:17:48 +0200
I try to create a script, which automatically generates 3gp files from flv files. Can ffmpeg analyze, if the source-video is 4:3 or 16:9 in a first step, so that I can create the video in a second step with the correct target format?
ffmpeg -i input.flv 2>&1 | sed -e '/DAR/!d; s/^.*DAR \([0-9]*:[0-9]* \).*/\1/'
should give you the display aspect ratio of input.flv.
Sorry, no, it doesn't for flv afaics. Bugger.
Ah, wait, this monster works for flv; it outputs 1.333 for 4:3 and 1.777 for 16:9 :
ffmpeg -i input.flv 2>&1 | \ sed -e '/Video: flv/!d; s/.* \([0-9]*\)x\([0-9]*\).*/scale=3;\1\/ \2/' | bc
Tested this time!
c -- Was hei?t hier Dogma, ich bin Underdogma! [ What the hell do you mean dogma, I am underdogma. ] _F R E E_ _V I D E O S_ http://www.blacktrash.org/underdogma/ http://www.blacktrash.org/underdogma/index-en.html _______________________________________________ ffmpeg-user mailing list ffmpeg-user at mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
On Tue, 30 Jun 2009 12:18:00 -0400 Oliver Brodwolf wrote:
Hello
I try to create a script, which automatically generates 3gp files from flv files. Can ffmpeg analyze, if the source-video is 4:3 or 16:9 in a first step, so that I can create the video in a second step with the correct target format? Or is there a other tool, which I have to use for analyze the source- file?
ffmpeg -i _HKzRW5qYDo.flv 2>&1| perl -lne 'print $1/$2 if( /(\d+)x(\d+)/)'
participants (4)
-
blacktrash@gmx.net -
dave@topekadesign.com -
oliver@mountain.ch -
Rhubbell@iHubbell.com