VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    Hello,

    I used the following ffmpeg command to further compress a video:

    Code:
    ffmpeg -i input.mkv -c:v libx264 -vf scale=720:-2 -pix_fmt yuv420p -c:a aac -b:a 128k -ac 2 -ar 44100 -threads 2 -f mp4 output.mp4
    Notice the "-2" which I read somewhere.

    Still, the frame ratio isn't preserved (as reported by ffprobe.exe):
    Code:
    Input #0, matroska,webm, from 'input.mkv':
      Metadata:
        ENCODER         : Lavf57.71.100
      Duration: 00:23:55.84, start: 0.000000, bitrate: 9229 kb/s
        Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, top first), 720x576 [SAR64:45 DAR 16:9], SAR 1:1 DAR 5:4, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    
        Metadata:
          DURATION        : 00:23:55.840000000
        Stream #0:1(unknown): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    
        Metadata:
          DURATION        : 00:23:55.816000000
          
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf57.83.100
      Duration: 00:00:27.20, start: 0.000000, bitrate: 600 kb/s
        Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x576 [SAR 1:1 DAR 5:4], 464 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(unk): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    
        Metadata:
          handler_name    : SoundHandler
    Is there a simple way to tell ffmpeg to not mess with the frame ratio?

    Thank you.
    Last edited by yetanotherlogin; 15th Dec 2017 at 08:02.
    Quote Quote  
  2. Member Bernix's Avatar
    Join Date
    Apr 2016
    Location
    Europe
    Search Comp PM
    Do you really need scale? It seems to me be redundant.
    I think -2 means the resulted height will be even number. (I think) -1 means keep aspect ratio when resizing.
    But scaling seem to be here as I mentioned above, try setdar=16/9 to your command line to be sure it is 16/9 set.


    Bernix
    Last edited by Bernix; 15th Dec 2017 at 07:13.
    Quote Quote  
  3. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    Thanks.

    Yes, I do need it, because the output looks weird. The original is at the top:



    Here's the command I used:
    Code:
    ffmpeg -i input.mkv -c:v libx264 -vf setdar=dar=4/3 -vf scale=720:-1 -pix_fmt yuv420p -c:a aac -b:a 128k -ac 2 -ar 44100 -threads 2 -f mp4 output.mp4
    ---
    Edit: Found it. It was "setdar=16:9":

    Code:
    ffmpeg -i input.mkv -c:v libx264 -vf scale=720:-1,setdar=16:9 -pix_fmt yuv420p -c:a aac -b:a 128k -ac 2 -ar 44100 -threads 2 -f mp4 output.mp4
    Thank you.
    Last edited by yetanotherlogin; 15th Dec 2017 at 08:01.
    Quote Quote  
  4. Member Bernix's Avatar
    Join Date
    Apr 2016
    Location
    Europe
    Search Comp PM
    Edit:
    I don't know ffmpeg well, but form 16:9 doesn't looks to me good, prefer 16/9. I hope it will works too. Semicolon not sure about properly interpreted.
    My bad I though that semicolon is colon Sorry
    Bernix
    Last edited by Bernix; 15th Dec 2017 at 08:22. Reason: Edit
    Quote Quote  
  5. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    There's still a bit of a problem: How can I get rid of the black bars on both sides?

    Quote Quote  
  6. Just don't rescale in first place...
    Quote Quote  
  7. Why don't you just specify the height along with the width?

    Code:
    -vf scale=720:404
    Or if you're too lazy to figure out the height use the negative modulus as indicated earlier.
    Quote Quote  
  8. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    My bad: The black borders are added by the video editor I use before further compressing with ffmpeg.
    Quote Quote  



Similar Threads

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