VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Member
    Join Date
    Jul 2014
    Location
    Indonesia
    Search Comp PM
    Hi all,

    I 've tried some command line given in some thread about changing aspect ration of MP4 using ffmpeg.

    Too bad that all of them is through re encoding process.

    Do anyone know what line used to change aspect ration of MP4 video without re encode using ffmpeg?

    Thanks in advanced
    Quote Quote  
  2. -i input.mp4 -vcodec copy -acodec copy -aspect x:y output.mp4
    Quote Quote  
  3. Not all players will obey aspect ratio flags.
    Quote Quote  
  4. You might want to consider mp4box, since its more reliable for changing AR than ffmpeg
    Quote Quote  
  5. Member
    Join Date
    Jul 2014
    Location
    Indonesia
    Search Comp PM
    Originally Posted by smrpix View Post
    -i input.mp4 -vcodec copy -acodec copy -aspect x:y output.mp4
    Thanks it works perfectly Name:  smiley_beer.gif
Views: 24090
Size:  5.7 KB

    Originally Posted by poisondeathray View Post
    You might want to consider mp4box, since its more reliable for changing AR than ffmpeg
    May I know how come ffmpeg is less reliable in AR changing?
    Last edited by morsh; 15th Jul 2014 at 20:09.
    Quote Quote  
  6. Originally Posted by morsh View Post

    May I know how come ffmpeg is less reliable in AR changing?


    It's ok , as long as it worked for you

    1) ffmpeg's -aspect x:y is really affecting the DAR (display aspect ratio) at the container level, mp4box writes data as PAR (pixel aspect ratio), also known as SAR (sample aspect ratio) at the bitstream level in the header as a VUI parameter. So you demux it, changes are gone with ffmpeg, but stay with mp4box. Out of the players that accept either, more players tend to accept stream level changes than container level changes (more reliable) . Also , there is more control with PAR values, you can distinguish between ITU vs. non ITU aspect ratios more easily (The short version is basically there are cases where you need to acknowledge different ways of AR interpretation)

    2) ffmpeg's MP4 muxer seems less reliable , at least in the past. Sometimes muxes did not play correctly on some devices, yet the same mux with mp4box, or l-smash works fine. This has to do with MP4 muxes in general, not necessarily AR changing only
    Quote Quote  
  7. Member
    Join Date
    Jul 2015
    Location
    California, Yankeeland
    Search Comp PM
    Originally Posted by smrpix View Post
    -i input.mp4 -vcodec copy -acodec copy -aspect x:y output.mp4
    YES! I had no idea this was so simple. Thanks much. I've been looking for a way to fix bollixed-up aspect ratios (for VLC, anyway), without re-encoding, for a long time now. Had no idea ffmpeg could do this in seconds. It wasn't said above, but this seems to work with any format ffmpeg can read; I just did it with some old WMV music video, and it worked perfectly.
    Quote Quote  
  8. There's a muxing-only build of ffmpeg here that'll modify info such as aspect ratio in the video bitstream.
    http://forum.doom9.org/showthread.php?t=152419

    One advantage off the top of my head (I've not used it in a fair while) is it'll mux from one container to another.

    I read through a bit of the thread a linked to and it appears the ffmpeg build can still accept "-aspect x:y" or "-aspect X" in the commandline to change the container aspect ratio along with a SAR to change the bitstram aspect ratio. If so, it's a pity both aspect ratios can't be expressed the same way, but it appears it probably can change both the container and bitstream aspect ratios at the same time. Maybe I missed that the first time I used it, as to fix problem aspect ratios in the past I've remuxed with the ffmpeg build I linked to while changing the SAR in the bitstream, then I've remuxed them again with MKVMergeGUI to set the container aspect ratio. When both aspect ratios are the same, at least there won't be conflicts.
    Last edited by hello_hello; 9th Jul 2015 at 05:23.
    Quote Quote  
  9. Member
    Join Date
    Oct 2016
    Location
    Cambridge (well, near)
    Search Comp PM
    I have been using ffmpeg to change change the aspect ratio of video files (actually .avi to mp4) on a Ubuntu & a Gumstix COM. This tested OK with snippets, but we have become aware that for larger files (~100MB, which is not that large for a video) the process seems not to work. A file gets copied with the new file extension and no errors are reported but the file won't open in MP4Explorer (which I use to examine the track header box values) and plays with the wrong aspect ratio in (e.g.) VLC.
    How could it work for small files but not for larger ones?
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!