How can I convert AVI files into MPGs with ffmpeg?

63

Solution 1

mpeg instead of mpg

ffmpeg -i file.avi -vcodec mpeg4 -f mpeg output.mp4

Solution 2

Thanks to Andreas Cadhalpun ffmpeg now has new filter: mpeg4_unpack_bframes (see ref).

Usage is as simple as:

ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.mpg

Solution 3

I'd use MPEG Streamclip. It's really simple. Although they haven't updated the software in a while, I've been using the same version for years (most recently on my Intel Mac with OS 10.6.6). It's good for individual files. Not sure about batching. Good luck.

MPEG Streamclip is a powerful free video converter, player, editor for Mac and Windows. It can play many movie files, not only MPEGs; it can convert MPEG files between muxed/demuxed formats for authoring; it can encode movies to many formats, including iPod; it can cut, trim and join movies. MPEG Streamclip can also download videos from YouTube and Google by entering the page URL.

Share:
63

Related videos on Youtube

Rodrigo Amaro
Author by

Rodrigo Amaro

Updated on September 17, 2022

Comments

  • Rodrigo Amaro
    Rodrigo Amaro almost 2 years

    I'll try to be very specific. Look, I have an input that sends an array:

    echo "<input type='hidden' name='valortot[]'  class='valor$rowid' disabled>";
    

    Once I click in a radio button the disable is removed and the value is set:

    Radio button:

    <input  class='radio$rowid'  name='".$codintercot."[]' value='$mpreco' type='radio' onclick='calcval($rowid,$valortot)'>
    

    $rowid is the id of each row and $valortot is the value got by javascript and once clicked is insert in the hidden input.

    The Javascript:

     <script type="text/javascript">
    
                 function calcval(valor,valortot){
    
                    var valortot = valortot;
                    var rowid = valor;
                    var calcval = document.getElementsByClassName("valor"+rowid);
    
                    for(var i = 0; i < calcval.length; i++) {
                        calcval[i].value=valortot;
                        calcval[i].disabled = false;
                    }
    
    
                 }
    

    My problem is, when I send the array they're copied, duplicates can exist, like 2 itens with the same value, but not a copy next the value like this:

    Array ( [0] => 2.44 [1] => 2.44 [2] => 3.7 [3] => 32.92 [4] => 32.92 )
    

    It's odd, 2.44 and 32.92 were copied but not 3.7, how can I skip clones?

    EDIT:

    Oh I fould, I was enabling 3 at same time while I should just enable 1. But still thank you guys.

    • slhck
      slhck over 13 years
      Have you tried repairing the file? ffmpeg -i infile.avi -acodec copy -vcodec copy outfile.avi
    • xralf
      xralf over 13 years
      Yes, outfile.avi has the same problem.
  • xralf
    xralf over 13 years
    This writes error message: Unknown encoder 'aac'
  • xralf
    xralf over 13 years
    I'm on Linux (Ubuntu).
  • jet
    jet over 13 years
    I edited my answer - try
  • xralf
    xralf over 13 years
    This writes: Error while opening codec for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height
  • jet
    jet over 13 years
    ffmpeg -i file.avi -vcodec mpeg4 -s 320x240 -b 300k -r 23.98 -acodec libmp3lame -ar 48000 -ab 112k output.mp4 - you can play with size and bitrate
  • xralf
    xralf over 13 years
    The same error.
  • parsecer
    parsecer about 3 years
    I get buffer underflow error. When it finished converting, the video works, but there is no sound