VideoHelp Forum
+ Reply to Thread
Results 1 to 11 of 11
Thread
  1. Hello all, I’m trying to convert a video and change these parameters:

    resolution from 1.280x720 to 640x360 pixels
    average bitrate: from 1.410 to 300 kb/s
    maximum bitrate: from 1.680 to 2500 kb/s
    Sampling rate : from 48.0 to 44.1 kHz
    Bit rate audio: 128 kb/s

    I used this string with ffmpeg vers. 4.3.2-2021-02-20 full build:

    Code:
    ffmpeg -i input.mp4 -c:v -vf scale=640:360 libx264 -b:v 300k -maxrate 2500k -bufsize 2500k -crf 25 -c:a -ar 44100 libfdk_aac -b:a 128k output.mp4

    I get the error: “ffmpeg unable to find a suitable output format for scale ‘640:360’ scale 640:360: invalid argument”. Could you help me pleae?

    Below is the original file analyzed by MediaInfo, thanks!


    Code:
    General
    Complete name                            : C:\Users\parvares\Desktop\input.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media
    Codec ID                                 : isom (isom/iso2/avc1/mp41)
    File size                                : 424 MiB
    Duration                                 : 38 min 21 s
    Overall bit rate                         : 1 545 kb/s
    Writing application                      : Lavf58.64.100
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@Level3.1
    Format settings                          : CABAC / 4 Ref Frames
    Format settings, CABAC                   : Yes
    Format settings, Reference frames        : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 38 min 21 s
    Bit rate                                 : 1 410 kb/s
    Maximum bit rate                         : 1 680 kb/s
    Width                                    : 1 280 pixels
    Height                                   : 720 pixels
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Constant
    Frame rate                               : 25.000 FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.061
    Stream size                              : 387 MiB (91%)
    Writing library                          : x264 core 161 r3027 4121277
    Encoding settings                        : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 / keyint_min=125 / scenecut=40 / intra_refresh=0 / rc_lookahead=125 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=1680 / vbv_bufsize=8400 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
    Color range                              : Limited
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    Codec configuration box                  : avcC
    
    Audio
    ID                                       : 2
    Format                                   : AAC LC
    Format/Info                              : Advanced Audio Codec Low Complexity
    Codec ID                                 : mp4a-40-2
    Duration                                 : 38 min 21 s
    Bit rate mode                            : Constant
    Bit rate                                 : 129 kb/s
    Channel(s)                               : 2 channels
    Channel layout                           : L R
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 46.875 FPS (1024 SPF)
    Compression mode                         : Lossy
    Stream size                              : 35.3 MiB (8%)
    Default                                  : Yes
    Alternate group                          : 1
    Last edited by parvares; 12th Apr 2021 at 03:22.
    Quote Quote  
  2. ffmpeg -i input.mp4 -vf scale=640:360 -c:v libx264 -b:v 300k -maxrate 2500k -bufsize 2500k -crf 25 -c:a libfdk_aac -ar 44100 -b:a 128k output.mp4
    Quote Quote  
  3. Thanks, ProWo, I'm getting this error

    unknown encoder 'libfdk_aac'
    I tried to change:

    libfdk_aac to
    aac

    Now I get a warning with the resulting file:
    unknown encoder 'libfdk_aac'
    Last edited by parvares; 8th Apr 2021 at 07:07.
    Quote Quote  
  4. Just "-c:a aac" instead of "-c:a libfdk_aac" then. Or get a version of ffmpeg with libfdk_aac.
    Quote Quote  
  5. Thanks, when I get the output video analyzed by Media info I get 285 kb/s for average bitrate (instead of 300 kb/s) and I don't get the maximum bit rate (2500 kb/s). Does this depend on the bufsize value I set (2500k)? Which value should I change? Thanks very much!
    Last edited by parvares; 8th Apr 2021 at 15:16.
    Quote Quote  
  6. Use
    ffmpeg -i input.mp4 -vf scale=640:360 -c:v libx264 -crf 18 -c:a aac -ar 44100 -b:a 128k output.mp4
    instead.
    Quote Quote  
  7. ProWo, thanks a lot. The output gives me now an average bitrate of 486 kb/s, but trying without -crf and -maxrate commands I get exactly the average rate output I need, 300 kb/s.

    Code:
    ffmpeg -i input.mp4 -vf scale=640:360 -c:v libx264 -b:v 300k -bufsize 2500k -c:a aac -ar 44100 -b:a 128k output.mp4
    The strange thing is I have to disable my AVG Antivirus, because I get:

    ffmpeg\bin\output.mp4: permission denied
    Last edited by parvares; 9th Apr 2021 at 14:37.
    Quote Quote  
  8. Originally Posted by parvares View Post
    ProWo, thank, I tried, but MediaInfo gives me now an average bitrate of 486 kb/s, and no maxrate.
    I know, but the video quality is better. If you want a lower bitrate try higher CRF values (g.e. 20). Recommed values for x264 are 18-23.
    Quote Quote  
  9. I need to concat the output with another video with the same parameters I wrote (average bitrate: 300 kb/s, maximum bitrate: 2500 kb/s). If not I get the concatenated video 'pixelated'...
    Quote Quote  
  10. Originally Posted by parvares View Post
    I need to concat the output with another video with the same parameters I wrote (average bitrate: 300 kb/s, maximum bitrate: 2500 kb/s). If not I get the concatenated video 'pixelated'...
    Then try
    Code:
    ffmpeg -i input.mp4 -vf scale=640:360 -c:v libx264 -b:v 300k -maxrate 2500k -bufsize 2500k -c:a aac -ar 44100 -b:a 128k output.mp4
    Quote Quote  
  11. I tried your string, but when I concat the second video with MKVToolNix it comes grainy and pixalated.
    I had to add a parameter:

    Code:
    -preset fast
    which correspons to:
    --rc-lookahead 30 --ref 2 --subme 6

    Code:
    ffmpeg -i input.mp4 -vf scale=640:360 -c:v libx264 -preset fast -crf 25 -ar 44100 output.mp4
    Optional: -movflags +faststart

    Now there is no problem joining the videoes.
    Thanks again for your help!
    Last edited by parvares; 16th Apr 2021 at 01:53.
    Quote Quote  



Similar Threads

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