Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • Using FFMpeg with Runtime.exec() to do a simple transcoding

    1er novembre 2011, par Adam Ingmansson

    I know there are many questions touching this subject, but none have helped me solve my issue.

    Purpose:

    Transcoding a video taken,from a queue, from .mov to h.264 (for now only that)

    Solution:

    Building a java application that gets the next in the queue, transcodes it then repeat

    Problem:

    Running ffmpeg using Runtime.exec() is not working. Im using the StreamGobbler from this tutorial to capturing the output from the process.

    This code shows how i start my process:

    String[] command = new String[]{"./ffmpeg/ffmpeg","-i",videoFile.getPath(),"-vcodec","libx264","-fpre",preset,folder + recID + ".flv"};
    System.out.println("Running command..");
    Process p = r.exec(command);
    
     // any error message?
    StreamGobbler errorGobbler = new 
    StreamGobbler(p.getErrorStream(), "ERROR");            
    
    // any output?
    StreamGobbler outputGobbler = new 
    StreamGobbler(p.getInputStream(), "OUT");
    
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    
    //logProcessOutputAndErrors(p);
    
    int res = p.waitFor();
    if (res != 0) {
        throw new Exception("Encoding error: "+String.valueOf(res));
    }
    

    and this is the current modified version of StreamGobbler (the important part)

    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    int c = 0;
    StringBuilder str = new StringBuilder();
    
    while (true) {
        c = br.read();
    }
    

    Sometimes ffmpeg just stalls, maybe waiting for my input (although there is no indication on screen).

    Sometimes it just ends.

    Sometimes (when I added the line "System.out.print((char) c);" in the while-loop above) i got loads of "¿¿ï" repeated over and over again, wich might be the actual encoding of the video wich I managed to capture instead of to a file.

    For those who wonders why i dont just go with a commandline or maybe even php:

    The purpose is an application that will run 24/7 transcoding anything and everything from a queue. The files are pretty large to begin with and takes about 15 min to transcode.

  • "No accelerated colorspace conversion found from yuv420p to bgr24" when using OpenCV with FFMPEG on mac

    31 octobre 2011, par Itay k

    When trying to acquire a frame from a video file (I've tried several video formats) I am getting an error message "No accelerated colorspace conversion found from yuv420p to bgr24". The exact same code ran perfectly fine on a windows machine and I couldn't get it to run on a mac even after I recompiled and installed FFMPEG and OpenCV. I am using lion for my OS. Any ideas?

  • How can you only extract 30 seconds of audio using ffmpeg

    30 octobre 2011, par Jaggu

    I am using ffmpeg for audio conversion. I am using this command:

    ffmpeg -i file.mp3 file.wav
    

    This works fine. However I only want to my output file to contain maximum 1 minute of audio. How can I do that using ffmpeg?

  • ffmpeg mozilla mp3 to webm encoding issue

    30 octobre 2011, par Jaggu

    I want to encode my mp3 file into webm format so that it can be played in Firefox using HTML5 natively.

    This is the file that is converted format using ffmpeg using command:

    http://www.filesonic.in/file/2825764155

    ffmpeg -i test.mp3 -ab 128k test.webm
    

    The file gets converted successfully and I can play in firefox and chrome using HTML5's native audio feature.

    However problem is in FF when I want to jump to a particular second using slider it doesn't work anymore. It just stops playing. This problem doesn't occur in chrome etc.

    What can be the issue?

    Update: I tested in FF 7.0.1 and it still doesn't work.

  • Windows media player showing wrong bit rate

    30 octobre 2011, par Akash

    I used ffmpeg to change the bit rate of a .mp3 file from 128kbps to 64kbps

    here are the final lines of output of ffmpeg:

    size=    2261kB time=00:04:49.38 bitrate=  64.0kbits/s
    video:0kB audio:2261kB global headers:0kB muxing overhead 0.011274%
    

    Tough the file size is reduced by half, windows media player while playing the file shows the bit-rate is 159 K bits/second

    Any ideas on why is this so?