Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • php_ffmpeg extension installed, want to know available classes in this extension [on hold]

    25 septembre 2013, par user2808180

    I have successfully installed the php extension "php_ffmpeg" and it is working fine. I tested the extension with class ffmpeg_movie and It shows me complete information of the file.

    But the problem is to convert any uploaded video file to flv. Is there any classes available in the extension 'php_ffmpeg', I would like you to share some sample code for that.

    I will like to stick to php code as I am not sure that I might not get access to the share server shell.

    I also tried exec, on my Windows Based local machine, but I haven't found success beyond "DIR" command.

    Please if you have some knowledge about "php_ffmpeg" extension and classes available in it, with example code or know some resource which include that please help me.

    $return = 1;
    $output = array();
    
    $source = $_SERVER['DOCUMENT_ROOT'] . '/sample.avi';
    $target = $_SERVER['DOCUMENT_ROOT'] . '/target.flv';
    
    
    $cmd = "ffmpeg -i {$source} {$target}";
    
    exec($cmd, $output, $return);
    
    
    echo '
    '; print_r($output); echo '
    '; echo $cmd;
  • How to save file to s3 after processing by ffmpeg using carrierwave

    25 septembre 2013, par loganathan

    I am trying to convert the bit rate of the Mp3 file before uploading to S3, I can able to create version for the mp3 file but the version is not saving in s3 instead original file is uploading to s3.

      version :bitrate_96k do
        process :resample => "96"
      end
    
    def resample(bitrate)
        tmp_path   = File.join( File.basename(current_path), "tmpfile" )
        File.rename current_path, tmp_path
        audio_details  = `ffmpeg -i '#{tmp_path}' 2>&1`.split(",").split("\n").flatten
        file_bitrate =  audio_details.grep(/bitrate/).grep(/bitrate/).join.split("bitrate: ").last.split("\s").first
        unless file_bitrate == bitrate
          `ffmpeg -i #{tmp_path.shellescape}  -acodec libmp3lame -y -ab 96k #{current_path.path}`
          File.unlink(current_path)
         FileUtils.mv(temp_path, current_path)
        end
      end
    
  • FFMPEG Covert from MP4 to WEBM only working on some files.

    25 septembre 2013, par ShivamD

    I have tried the following URLs, using the streamio wrapper for FFMPEG. The URL's are

    http://static.bouncingminds.com/ads/5secs/baileys_5sec.mp4 (works)
    http://techslides.com/demos/sample-videos/small.mp4 (doesn't work) 
    

    For the latter I get the following error:

    Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
    

    The code I use to transcode them:

    movie.transcode("test.webm", "-vcodec libvpx -strict -2") { |p| puts p }
    

    As mentioned this works perfectly for the first video. Is there any specific setting I need in order to work with all mp4 videos?

  • Error in converting a MOV video into MP4 using ffmpeg

    25 septembre 2013, par user2767347

    I want to convert a mov video into mp4 using ffmpef library of php. I am using given code:

    $cmd='ffmpeg -i sample.mov -sameq output.mp4';
    echo exec($cmd);
    

    It is not working at all. Even I didn't get any error. Could anyone tell me the proper steps to do this conversion. I have tried a lot of code examples but not working for me.

  • Implementing '-async 1' in C code to correct out of sync audio

    25 septembre 2013, par Christian P.

    I have built a segmenter that takes as input a h264 / AAC video and segments according to the HLS specification. The source code for it can be seen here: https://gist.github.com/cpnielsen/f36729c371aac0fe535d

    It is implemented as a python extension, but the interesting parts are in the process_video() function. It makes use of the libav library (alternatively ffmpeg) to do the heavy lifting.

    It works 95% of the time, but we have come upon some videos where it produces segments with audio out of sync. If I was using the command-line tool, I could simply add -async 1 to fix it, but how do I implement the same functionality in my C code?

    I found a snippet of code in avconv_filter.c (for libav, not sure what the ffmpeg equivalent is) where they initiate the filter, but without any documentation it is hard to figure out how to do this outside the whole modular setup.

    I just need to:

    1. Initiate the correct filter
    2. Apply it to the input (or output? not sure)
    3. Know of any pitfalls when using the filter.

    Any help is welcome; sample code, explanation of the filter, etc.