Results 1 to 4 of 4

Thread: ffmpeg video quality

  1. #1
    Join Date
    May 2007
    Posts
    394

    Default FFmpeg not too bad

    Hey I found a setting I can add to the /include/settings/video_conversion.php that makes a big difference in the video quality, if you are using ffmpeg to encode

    Hit THE WALL to check this out with your own upload (shameless plug, eh? 8) )
    simply:

    -b <int> added before the video name, with <int> replaced with a video bitrate. The default is 200,000 (200k), which is why people probably think ffmpeg is crappy.

    I set my final video rate to 700, which is probably pretty CPU intensive when there's a lot of users, so I may turn it down to 500 at some point in the future. Here's what I've got in video_conversion.php

    Code:
    <?php
    
    // original ffmpeg command line is:
    $cmd_ffmpeg = "$config[ffmpeg] -i $video_src -acodec mp3 -ar 22050 -ab 32 -f flv -b 700 $video_flv";
    
    // I changed it to this to get higher quality video, adding the -b switch
    $cmd_ffmpeg = "$config[ffmpeg] -i $video_src -acodec mp3 -f flv -b 700000 $video_flv";

    To get FFMPEG in play instead of Mencoder in the first place, just a bit further down, change:

    Code:
    $cmd_all = $cmd_mencoder;
    to

    Code:
    $cmd_all = $cmd_ffmpeg;
    pretty simple. Thanks admin.


    Here are some more ffmpeg switches:

    Generic syntax :

    ffmpeg [[infile options][`-i' infile]]... {[outfile options] outfile}...

    Note : As a general rule, options are applied to the next specified file. Therefore, order is important, and you can have the same option on the command line multiple times. Each occurrence is then applied to the next input or output file.



    --------------------------------------------------------------------------------


    Main options :

    -ab <int> : Set the audio bitrate in bit/s ( default = 64k ).

    -acodec <string> : Force audio codec. Use the "copy" special value to specify that the raw codec data must be copied as is.

    -an : Disable audio recording.

    -ar <int> : Set the audio sampling frequency ( default = 44100 Hz ).

    -aspect <string or float> : Set aspect ratio ( 4:3, 16:9 or 1.3333, 1.7777 ).

    -async <int> : Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps, the parameter is the maximum samples per second by which the audio is changed. -async 1 is a special case where only the start of the audio stream is corrected without any later correction.

    -b <int> : Set the video bitrate in bit/s ( default = 200k ).

    -bf <int> : Set the number of B-frames ( supported for MPEG-1, MPEG-2 and MPEG-4 ).

    -b_strategy <boolean> : Strategy to choose between I/P/B-frames ( 0 = off / 1 = on ).

    -bufsize <int> : Set rate control buffer size ( in bits ).

    -cmp <string or int> : Full pel motion estimation compare function.
    sad ( 0 ) : Sum of absolute differences, fast ( default ).
    sse ( 1 ) : Sum of squared errors.
    satd ( 2 ) : Sum of absolute Hadamard transformed differences.
    dct ( 3 ) : Sum of absolute DCT transformed differences.
    psnr ( 4 ) : Sum of squared quantization errors ( avoid, low quality ).
    bit ( 5 ) : Number of bits needed for the block.
    rd ( 6 ) : Rate distortion optimal, slow.
    zero ( 7 ) : 0.
    vsad ( 8 ) : Sum of absolute vertical differences.
    vsse ( 9 ) : Sum of squared vertical differences.
    nsse ( 10 ) : Noise preserving sum of squared differences.
    w53 ( 11 ) : 5/3 wavelet ( only used in Snow ).
    w97 ( 12 ) : 9/7 wavelet ( only used in Snow ).
    dctmax ( 13 )
    chroma ( 14 )

    -coder <string or int> :
    vlc ( 0 ) : Variable length coder / huffman coder.
    ac ( 1 ) : Arithmetic coder.
    raw ( 2 ) : Raw ( no encoding ).
    rle ( 3 ) : Run-length coder.
    deflate ( 4 ) : Deflate-based coder.

    -cropbottom <int> : Set bottom crop band size ( in pixels ).

    -cropleft <int> : Set left crop band size ( in pixels ).

    -cropright <int> : Set right crop band size ( in pixels ).

    -croptop <int> : Set top crop band size ( in pixels ).

    -deinterlace : Deinterlace pictures.

    -dc <int> : Intra DC precision.

    -f <string> : Force format.

    -flags <string> :
    ildct : Use interlaced DCT.
    loop : Use loop filter.
    low_delay : Force low delay.

    -flags2 <string> :
    ivlc : Intra VLC table.
    non_linear_q : Use non linear quantizer.

    -g <int> : Set the group of pictures ( GOP ) size.

    -genpts <boolean> : Generate PTS ( 0 = off / 1 = on ).

    -i <string> : Input file name.

    -intra : Use only intra frames ( I-frames ).

    -me <string or int> : set motion estimation method.
    dia ( 1 ) : Diamond search, radius 1 ( fast ).
    hex ( 2 ) : Hexagonal search, radius 2 ( default ).
    umh ( 3 ) : Uneven multi-hexagon search.
    esa ( 4 ) : Exhaustive search ( slow ).

    -map <file:stream> : Set input stream mapping.

    -maxrate <int> : Set maximum video bitrate tolerance ( in bit/s ).

    -minrate <int> : Set minimum video bitrate tolerance ( in bit/s ).

    -pass <int> : Select the pass number ( 1 or 2 ). The statistics of the video are recorded in the first pass and the video is generated at the exact requested bitrate in the second pass.

    -pix_fmt <string> : Set pixel format ( yuv420p, yuv422p, yuv444p, yuv422, yuv410p, yuv411p, yuvj420p, yuvj422p, yuvj444p, rgb24, bgr24, rgba32, rgb565, rgb555, gray, monow, monob, pal8 ).

    -ps <int> : Set packet size in bits.

    -qmin <int> : Minimum video quantizer scale ( VBR ).

    -qmax <int> : Maximum video quantizer scale ( VBR ).

    -r <int or string> : Set frame rate ( Hz value, fraction or abbreviation ) : 25, 30000/1001, etc.

    -rc_init_occupancy <int> : Number of bits which should be loaded into the rate control buffer before decoding starts.

    -s <string> : Set frame size ( WidthxHeight or abreviation ).

    -subcmp <string or int> : Sub pel motion estimation compare function.
    sad ( 0 ) : Sum of absolute differences, fast ( default ).
    sse ( 1 ) : Sum of squared errors.
    satd ( 2 ) : Sum of absolute Hadamard transformed differences.
    dct ( 3 ) : Sum of absolute DCT transformed differences.
    psnr ( 4 ) : Sum of squared quantization errors ( avoid, low quality ).
    bit ( 5 ) : Number of bits needed for the block.
    rd ( 6 ) : Rate distortion optimal, slow.
    zero ( 7 ) : 0.
    vsad ( 8 ) : Sum of absolute vertical differences.
    vsse ( 9 ) : Sum of squared vertical differences.
    nsse ( 10 ) : Noise preserving sum of squared differences.
    w53 ( 11 ) : 5/3 wavelet ( only used in Snow ).
    w97 ( 12 ) : 9/7 wavelet ( only used in Snow ).
    dctmax ( 13 )
    chroma ( 14 )

    -ss <timecode> : Seek to given time position in seconds. hh:mm:ss[.xxx] syntax is also supported.

    -t <timecode> : Set the recording time in seconds. hh:mm:ss[.xxx] syntax is also supported.

    -timecode_frame_start <int> : Set the start timecode ( Non Drop Frame mode only ).

    -top <int> : Field dominance ( top = 1 / bottom = 0 / auto = -1 ).

    -trellis <int> : Rate-distortion optimal quantization.

    -vbsf <string> : Bitstream filters available are "dump_extra", "remove_extra", "noise", "imxdump".

    -vcodec <string> : Force video codec. Use the "copy" special value to tell that the raw codec data must be copied as is.

    -vn : Disable video recording.

    -vtag <string> : Force video FourCC/Tag.

    -y : Overwrite output files.

  2. #2
    Join Date
    Jul 2007
    Location
    Webmaster
    Posts
    2

    Default

    good stuff.. testing now..

    this is the first thing I changed.. something like 95% of my surfer have high speed.. so I want good video.
    .
    thanks

  3. #3

    Default Re: ffmpeg video quality

    Hello, can anyone help me? i try make the flash video file more little, but i dont had success till now, is always the same like the canghe i do in the config dont have effect...

    Code:
    $cmd_ffmpeg = "$config[ffmpeg] -i '$video_src' -acodec libmp3lame -ar 16000 -ab 24 -f flv -b 150 $video_flv";
    i put this configuration, where i mistake?

    thanks.

  4. #4

    Default Re: ffmpeg video quality

    <?php

    // original ffmpeg command line is:
    $cmd_ffmpeg = "$config[ffmpeg] -i $video_src -acodec mp3 -ar 22050 -ab 32 -f flv -b 700 $video_flv";

    // I changed it to this to get higher quality video, adding the -b switch
    $cmd_ffmpeg = "$config[ffmpeg] -i $video_src -acodec mp3 -f flv -b 700000 $video_flv";




    To get FFMPEG in play instead of Mencoder in the first place, just a bit further down, change:

    Code: Select all
    $cmd_all = $cmd_mencoder;



    to

    Code: Select all
    $cmd_all = $cmd_ffmpeg;



    pretty simple. Thanks admin.


    I made all the changes, but I don,t see any difference, what about the rest, did you do it in a video_conversion.php file?

Similar Threads

  1. Video Quality
    By Jimmii in forum Installation Support
    Replies: 17
    Last Post: 01-01-2009, 04:58 AM
  2. I need more quality video - HELP ME
    By uebas in forum General Discussions
    Replies: 4
    Last Post: 12-20-2008, 03:20 AM
  3. Quality Issue Question for FFMPEG *Please Help
    By Inferno in forum General Discussions
    Replies: 1
    Last Post: 11-16-2007, 08:31 PM
  4. Quality Adjustment ffmpeg render to flv - way to adjust HOW?
    By Dafydd in forum General Discussions
    Replies: 13
    Last Post: 10-07-2007, 10:09 AM
  5. Video Quality
    By ryce889 in forum Installation Support
    Replies: 5
    Last Post: 09-19-2007, 10:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •