VideoHelp Forum




+ Reply to Thread
Results 1 to 17 of 17
  1. Member
    Join Date
    Dec 2013
    Location
    Deutschland
    Search PM
    hi i wanted the simplest method to change the AR of a mp4 x264 file (16-9 > 4-3)

    i used mediacoder since it seems the best one


    now i changed that the AR in the video settings... and the file plays fine in the new AR



    but the filesize is almost doubled, how come ? i only changed the the AR and it needed to re process the whole file ?


    with mediacoder you cannot just change the header info without reprocessing the file?


    is there a way to change the AR without the file getting bigger (in the process of reprocessing) or even just change header info`?
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Mp4box. Google mp4box change aspect ratio for some command line examples.
    Quote Quote  
  3. Member
    Join Date
    Dec 2013
    Location
    Deutschland
    Search PM
    can't you with eg mediacoder not JUST change the AR and leave the video (or all other video settings) itself untouched?
    Quote Quote  
  4. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    I have never used mediacoder. And never will.

    But check if you can copy the video and ausio streams.
    Quote Quote  
  5. A Member since June, 2004 Keyser's Avatar
    Join Date
    Feb 2013
    Location
    Westernmost point of Europe
    Search Comp PM
    Use Mp4Box with the following command line:

    Mp4Box -par 1=PAR video.mp4

    Substitute video.mp4 by the name of your video and PAR by the pixel aspect ratio calculated this way:

    PAR = 4/3 * H/W ; where H = video height (pixels) and W = video width (pixels) and PAR should be in the form of N : D (withgout the spaces) where N and D are integers.
    Last edited by Keyser; 12th Jan 2014 at 12:54.
    "The greatest trick the Devil ever pulled was convincing the world he didn't exist."
    Quote Quote  
  6. Member
    Join Date
    Dec 2013
    Location
    Deutschland
    Search PM
    the problem is, if i put 4:3 it will stretch even more

    goes from this to this


    Width : 640 pixels
    Height : 360 pixels
    Display aspect ratio : 16:9


    Width : 640 pixels
    Height : 360 pixels
    Display aspect ratio : 2.40:1
    Quote Quote  
  7. 640x360 is a 16:9 aspect with square pixels, so I guess your video is 16:9 and you have to crop it vertically to get 4:3 aspect.

    Or it's really a 4:3 footage and you should have set MediaCoder to 512x384, in that case, you just have to change AR in stream header with FFmpeg (can be done with DVDx 4.1 Free Converter but it will re-rencode).
    Quote Quote  
  8. Member
    Join Date
    Dec 2013
    Location
    Deutschland
    Search PM
    it IS 4:3 FOOTAGE

    can you tell me the command too? (AR CHANGE)


    i read u can change it in the header AND video stream - i guess what i tried and failed (mp4box) was just the header while your suggestion is the video stream, maybe after i fix your suggestion i should retry fixing the other as well
    Quote Quote  
  9. One way to change the bitstream AR value is to use this modified ffmpeg build in this thread
    http://forum.doom9.org/showthread.php?t=152419

    If you have a 640x360 square pixel video that plays with a DAR of 16:9 , but you want it to play with a DAR of 4:3

    Display Aspect Ratio = Frame Aspect Ratio * Sample Aspect Ratio

    4/3 = 640/360 * x/y , where x/y is the sar value or sample aspect ratio

    So the value for SAR , x/y = 3:4

    Code:
    ffmpeg -i input.mp4 -vcodec copy -acodec copy -vbsf h264_changesps=sar=3:4 output.mp4
    In general , you don't want to change both stream AR and container AR, because you might get undesirable, additive effects depending on the decoder used
    Quote Quote  
  10. Originally Posted by poisondeathray View Post
    In general , you don't want to change both stream AR and container AR, because you might get undesirable, additive effects depending on the decoder used
    I don't understand..... if the stream and container aspect ratios are the same.......

    I'm fairly sure the Bluray player in this house which supports anamorphic MKV/MP4s ignores the container aspect ratio and uses the stream aspect ratio. Or maybe it's the other way around.... I forget. By default, LAV filters gives preference to the container aspect ratio.
    Last edited by hello_hello; 15th Jan 2014 at 17:18.
    Quote Quote  
  11. Container AR is supposed to override everything , but I've seen some cases where there were multiplicative causing extreme distortions depending on the decoding chain and software used to view

    There are also container inconsistencies between different containers - but I find MKV is the most consistent
    Quote Quote  
  12. Member
    Join Date
    Dec 2013
    Location
    Deutschland
    Search PM
    thanks for the calculation, i would have never gotten that

    i did try the 3:4 result with mp4box and it did work out !!
    so unless my player will not play it i won'T even need ffmpeg


    i did read somewhere else that it is advisable to change it both ways so it will not mess up



    edit :
    mediainfo now spits out the correct 4:3 instead of the cinema format
    Quote Quote  
  13. Member
    Join Date
    Dec 2013
    Location
    Deutschland
    Search PM
    say i have a bunch of paths in a txt, can you batch process these with either mp4box or ffmpg ?

    btw it says with ffmpeg:
    unknown bitstream filter h264 changesps=dar=3:4
    Quote Quote  
  14. Originally Posted by baracus View Post
    say i have a bunch of paths in a txt, can you batch process these with either mp4box or ffmpg ?

    btw it says with ffmpeg:
    unknown bitstream filter h264 changesps=dar=3:4
    it's sar, not dar

    You need to use the modified ffmpeg build . You can rename it if you want e.g ffmpeg.roozhou.exe

    Yes you can batch process a folder , But it gets trickier to do it from a text file or processing subfolders , but it should be possible as well

    For one folder:

    Code:
    for %a in ("*.mp4") do ffmpeg -i %a -vcodec copy -acodec copy -vbsf h264_changesps=sar=3:4 %~na.new.mp4
    Quote Quote  
  15. Member
    Join Date
    Dec 2013
    Location
    Deutschland
    Search PM
    it seems i still got the syntax slighty wrong... do i have to put some path somewhere?








    C:\Program Files (x86)\tools\test>for %a in ("*.mp4") do "C:\Program Files (x86)
    \tools\ffmpg\ar change\ffmpeg.exe" -i %a -vcodec copy -acodec copy -vbsf h264_ch
    angesps=sar=3:4 %~na.new.mp4


    C:\Program Files (x86)\tools\test>"C:\Program Files (x86)\tools\ffmpg\ar change\
    ffmpeg.exe" -i The Jets - Crush On You (1985) - YouTube.mp4 -vcodec copy -acodec
    copy -vbsf h264_changesps=sar=3:4 The Jets - Crush On You (1985) - YouTube.new.
    mp4
    ffmpeg version N-31792-g51fb933, Copyright (c) 2000-2011 the FFmpeg developers
    built on Aug 11 2011 23:13:25 with gcc 4.5.2
    configuration:
    libavutil 51. 11. 1 / 51. 11. 1
    libavcodec 53. 10. 0 / 53. 10. 0
    libavformat 53. 6. 0 / 53. 6. 0
    libavdevice 53. 2. 0 / 53. 2. 0
    libswscale 2. 0. 0 / 2. 0. 0
    The: No such file or directory
    Quote Quote  
  16. Open the command prompt in the same directory as the files , and you don't need to specify the paths , except for ffmpeg.exe path . If the modified ffmpeg is in the system directory, or set up as environment variable, then you don't need to specify the ffmpeg path either . If I were you , I would rename the ffmpeg binary - so as not to confuse it with the "normal" one (in the example below I named it "ffmpeg.roozhou"

    The Jets - Crush On You (1985) - YouTube.mp4
    If there are spaces in your file names, you need to put the entries in quotes (for input and output)

    e.g
    Code:
    for %a in ("*.mp4") do "PATH\ffmpeg.roozhou" -i "%a" -vcodec copy -acodec copy -vbsf h264_changesps=sar=3:4 "%~na.new.mp4"
    Last edited by poisondeathray; 16th Jan 2014 at 16:19.
    Quote Quote  
  17. Member
    Join Date
    Dec 2013
    Location
    Deutschland
    Search PM
    thanks

    thats what i did ... it was the quotes that i forgot (as you can see there are spaces in the title names)
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!