Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffpmeg vs ffprobe performance

    13 décembre 2016, par Thomas

    I wanted to try extracting frames at scene changes with ffmpeg, vs. getting the frame numbers with ffprobe and extracting them later.

    But I had a surprise: ffprobe seems to be much slower than ffmpeg, while ffmpeg is taking the frames, resizing and saving them as well.

    ffmpeg command line:

    ffmpeg -hide_banner -y -i d:/test/m/long.mkv -vf "select=gt(scene\,0.4), showinfo, scale=320:-1, tile=12x200" -vsync 0 thumbnails%03d.png
    

    this takes: 488 seconds

    ffprobe command line:

    ffprobe -show_frames -of compact=p=0 -f lavfi "movie=/test/m/long.mkv,select=gt(scene\,.4)"
    

    this takes: 899 seconds

    I am missing something?

  • Video conversion too long

    13 décembre 2016, par Ilya Shpakovsky

    I use NReco.VideoConverter for convert flv to ogv. But this process is too long. I tried to convert 200M video but it took more than hour. The code I use:

    var ffMpeg = new FFMpegConverter();
    command = String.Format("-i \"{0}\" -c:v libtheora -c:a libvorbis -preset ultrafast \"{1}\"", inputFile, outputFile);
    ffMpeg.Invoke(command);
    

    Could anyone suggest me how to improve the performance of conversion? Thanks in advance.

  • ffmpeg in PHP : Resizing image works, but getting a 404 when trying to load resized image ?

    13 décembre 2016, par Eric David Sartor

    PHP:

    if ($output = shell_exec("ffmpeg -i localhost/video/tools/poster.png -vf scale=32:32 localhost/video/tools/poster_small.png 2>&1") !== NULL)
        echo $output;
    
    echo "Original:


    Resize:
    ";

    So I'm trying to have an image upload form that creates a smaller version of the uploaded image after the upload is verified. All that works fine, and when I run this command with ffmpeg, the $output is 1. That obviously means that it isn't returning NULL, which means ffmpeg is functioning in theory...but here's the weird part...

    I'm echoing the images out into the HTML to visually verify if they worked, and what I get (for the resized image) is a 32x32 image container, but the image doesn't load (404 in the dev console), which to me makes no sense. If the image container is 32x32, that means that the resize must've worked because that's the size I told it to be in the ffmpeg command, but if the page isn't loading the image, how did it even get the information that the image needed to be 32x32? I didn't set that in the HTML/CSS anywhere...what's going on here?

    I'm running this on Windows in a XAMPP server. I've installed ffmpeg and verified it is working in the Windows command prompt. All the files are in localhost/video/tools/, other than the ffmpeg files of course, which are in localhost/ffmpeg/.

    A screenshot of the HTML output: http://ericsartor.ca/Capture.PNG

  • Converting Video files in a Azure Webjob with ffMpeg

    13 décembre 2016, par Kevin Phifer

    I'm having trouble using ffMpeg in an Azure webjob.

    I found the following article (How to call ffmpeg.exe to convert audio files on Windows Azure?) and it is exactly what I want to do, however, I cannot get ffMpeg to execute and it gives no error message.

    To diagnose the problem, I have boiled it down to its essentials by uploading ffMpeg, a video file to convert, and batch file to run it:

    files in directory

    The script in run.cmd is simply:

    del output.mp4
    ffmpeg -i screencast.wmv -c:v libx264 -r 15 output.mp4
    

    This works on my personal machine, but ran as a webjob I get results below.

    [12/08/2015 15:42:39 > bf9dd6: SYS INFO] Status changed to Initializing
    [12/08/2015 15:42:39 > bf9dd6: SYS INFO] Job directory change detected: Job file 'ffmpegtest\output.mp4' exists in source directory but not in working directory.
    [12/08/2015 15:42:47 > bf9dd6: SYS INFO] Run script 'run.cmd' with script host - 'WindowsScriptHost'
    [12/08/2015 15:42:48 > bf9dd6: SYS INFO] Status changed to Running
    [12/08/2015 15:42:48 > bf9dd6: INFO] [12/08/2015 15:42:48 > bf9dd6: INFO] D:\local\Temp\jobs\triggered\ffMpeg\y1bdnb1e.03k\ffmpegtest>del output.mp4 [12/08/2015 15:42:48 > bf9dd6: INFO] [12/08/2015 15:42:48 > bf9dd6: INFO] D:\local\Temp\jobs\triggered\ffMpeg\y1bdnb1e.03k\ffmpegtest>ffmpeg -i screencast.wmv -c:v libx264 -r 15 output.mp4 [12/08/2015 15:42:49 > bf9dd6: SYS INFO] Status changed to Failed [12/08/2015 15:42:49 > bf9dd6: SYS ERR ] Job failed due to exit code -1073741515

    Edit: Additionally, it was suggested that I run using Kudu console. Still no luck:
    Kudu Screenshot

    Solution:
    I ended up needing to run the 32 version of ffMpeg and not the 64 bit. Thanks so much @mathewc !

  • ffmpeg Exception : Working Directory : null Environment : null

    13 décembre 2016, par Dylan

    Creating the Android app, I am trying to crop video using ffmpeg library and store it in the app directory. I created the command:

    String command = "ffmpeg -i /storage/emulated/0/DMC/diamondVideo.mp4 -vf crop=471:592:162:462 -c:a copy /storage/sdcard0/DMC/diamondVideoCropped.mp4";
    String[] cmd = command.toString().split(" ");
    

    After that I pass this command to the AsyncTask:

    new CropVideoTask().execute(cmd);
    

    And in my AsyncTask I execute this command:

    private class CropVideoTask extends AsyncTask {
    protected Void doInBackground(String[]... cmd) {
       FFmpeg ffmpeg = FFmpeg.getInstance(getContext());
       try {
           ffmpeg.execute(cmd[0], new ExecuteBinaryResponseHandler() {
    
               @Override
               public void onStart() {}
    
               @Override
               public void onProgress(String message) {}
    
               @Override
               public void onFailure(String message) {}
    
               @Override
               public void onSuccess(String message) {}
    
               @Override
               public void onFinish() {}
    
           });
       } catch (FFmpegCommandAlreadyRunningException e) {
           // Handle if FFmpeg is already running
       }
       return null;
    }
    

    After the code enters in onStart method, it throw an Exception:

    12-13 15:43:02.832 28941-32324/com.example.dmc E/FFmpeg: Exception while trying to run: [Ljava.lang.String;@42851b38
                                                            java.io.IOException: Error running exec(). Command: [/data/data/com.studioidan.dmc/files/ffmpeg, ffmpeg, -i, /storage/sdcard0/DMC/diamondVideo.mp4, -vf, crop=471:592:162:462, -c:a, copy, /storage/sdcard0/DMC/diamondVideoCropped.mp4] Working Directory: null Environment: null
                                                                at java.lang.ProcessManager.exec(ProcessManager.java:211)
                                                                at java.lang.Runtime.exec(Runtime.java:168)
                                                                at java.lang.Runtime.exec(Runtime.java:123)
                                                                at com.github.hiteshsondhi88.libffmpeg.ShellCommand.run(ShellCommand.java:10)
                                                                at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:38)
                                                                at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:10)
                                                                at android.os.AsyncTask$2.call(AsyncTask.java:287)
                                                                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
                                                                at java.util.concurrent.FutureTask.run(FutureTask.java:137)
                                                                at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
                                                                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
                                                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
                                                                at java.lang.Thread.run(Thread.java:856)
                                                             Caused by: java.io.IOException: No such file or directory
                                                                at java.lang.ProcessManager.exec(Native Method)
                                                                at java.lang.ProcessManager.exec(ProcessManager.java:209)
                                                                at java.lang.Runtime.exec(Runtime.java:168)
                                                                at java.lang.Runtime.exec(Runtime.java:123)
                                                                at com.github.hiteshsondhi88.libffmpeg.ShellCommand.run(ShellCommand.java:10)
                                                                at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:38)
                                                                at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:10)
                                                                at android.os.AsyncTask$2.call(AsyncTask.java:287)
                                                                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
                                                                at java.util.concurrent.FutureTask.run(FutureTask.java:137)
                                                                at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
                                                                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
                                                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
                                                                at java.lang.Thread.run(Thread.java:856)
    

    Manifest.xml contains premission

    
    

    Did I miss something?