Jump to content


Photo
- - - - -

need help fixing ffmpeg mobile aspect ratio conversion issue

ffmpeg mobile ipod conversion

  • Please log in to reply
3 replies to this topic

#1 brianatthebeach

brianatthebeach

    Member

  • Members
  • PipPipPip
  • 107 posts

Posted 03 September 2016 - 03:34 AM

Hi,
 
I have installed on my server
FFmpeg version 0.6.5, Copyright © 2000-2010 the FFmpeg developers
 
Below is the command from the avs script function_conversions.php where I have forced all mobile conversions to use this command.  However, as is known this command does not maintain the original aspect ratio of some phone videos, for example, where phone was held vertically resulting in a video aspect ratio of 9:16 or 720 width by 1280 height.  The command below results in a stretched video, of course.
 
I know in newer versions of ffmpeg there is a scale filter but is it possible to get my version to respect the aspect ratio of the videos described?  I am researching but maybe someone here has already addressed this issue?
 
$cmd = $config['ffmpeg']." -i ".$src." -y -vcodec libx264 -vpre slow -vpre baseline -b 1000k -bt 750k -acodec libfaac -ac 2 -ar ".$e['audio_sampling']." -ab ".$e['audio_bitrate']." -s 640x360 -aspect 16:9 ".$podFile;
 
Thanks,
Brian


#2 brianatthebeach

brianatthebeach

    Member

  • Members
  • PipPipPip
  • 107 posts

Posted 03 September 2016 - 03:48 AM

I see these ffmpeg video options

 

-s size             set frame size (WxH or abbreviation)

-aspect aspect      set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)

 

so I could probably simply do the math and replace this part of the code with the resulting size or aspect ratio?

 

it appears from the code that we can extract $aspect, $width_new_divby, and $height_new_divby and use to modify that part of the ffmpeg command.  

 

-s 640x360 -aspect 16:9

 

If anyone has comment or suggestion please advise.

 

Thanks,

Brian



#3 dargre

dargre

    Senior Member

  • Members
  • PipPipPipPipPip
  • 991 posts

Posted 04 September 2016 - 10:55 PM

Use: -s ".$width_new_dvby."x".$height_new_divby"  without aspect

$cmd = $config['ffmpeg']." -i ".$src." -y -vcodec libx264 -vpre slow -vpre baseline -b 1000k -bt 750k -acodec libfaac -ac 2 -ar ".$e['audio_sampling']." -ab ".$e['audio_bitrate']." -s ".$width_new_divby."x".$height_new_divby." ".$podFile;

But still it's very far from what it should be and of course it's for older versions of ffmpeg.


Edited by dargre, 04 September 2016 - 10:57 PM.

VIDEO.JS - best HTML5 player in the world for AVS script

NUEVOPLAYER 8 - best flash+html5 player for video scripts
Mods, custom code by NuevoLab (Search Suggest, Multiple image upload, Seo mods,and much more)


#4 brianatthebeach

brianatthebeach

    Member

  • Members
  • PipPipPip
  • 107 posts

Posted 05 September 2016 - 01:26 AM

Thanks, dargre, I will try that.  It should good enough for now but I would love to update to latest version but as you point out it can be almost impossible to compile latest version.

 

thanks,

Brian