Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to take pictures of the video through mplayer or ffmpeg to php ?

    22 novembre 2012, par Zhasulan Berdybekov

    How to take pictures of the video through mplayer or ffmpeg to php?

  • How to display a frame number on each frame of a video using ffmpeg ?

    22 novembre 2012, par igorg

    The test command I have is as follows:

    ffmpeg -i in.mov -vf "drawtext=fontfile=/usr/share/fonts/ttf-bitstream-vera/Vera.ttf: x=(w-tw)/2: y=h-(2*lh)-n: fontcolor=white: fontsize=40: box=1: boxcolor=0x00000000@1: text=" -an -y out.mov
    

    I want to display the frame number on each frame. However, setting the "text" variable to "n" does not help (it displays n) and %n seems to be the new line symbol. The thing that confuses me most is that this part

    y=h-(2*lh)-n
    

    works well, meaning it gets the right value of the current frame and moves the text up accordingly.

  • Capture FFMPEG output in PHP

    22 novembre 2012, par Andrew

    I need to read the output from ffmpeg in order to even try the solution to my question from yesterday. This is a separate issue from my problem there, so I made a new question.

    How the heck do I get the output from an ffmpeg -i command in PHP?

    This is what I've been trying:

    <?PHP
        error_reporting(E_ALL);
        $src = "/var/videos/video1.wmv";
        $command = "/usr/bin/ffmpeg -i " . $src;
        echo "",$command,"
    "; $command = escapeshellcmd($command); echo "backtick:
    ";
        `$command`;
    
        echo "

    system:
    ";
        echo system($command);
    
        echo "

    shell_exec:
    ";
        echo shell_exec($command);
    
        echo "

    passthru:
    ";
        passthru($command);
    
        echo "

    exec:
    ";
        $output = array();
        exec($command,$output,$status);
        foreach($output AS $o)
        {
                echo $o , "
    "; } echo "

    popen:
    ";
        $handle = popen($command,'r');
        echo fread($handle,1048576);
        pclose($handle);
        echo "

    "; ?>

    This is my output:

    /usr/bin/ffmpeg -i /var/videos/video1.wmv
    backtick:

    system:

    shell_exec:

    passthru:

    exec:

    popen:

    I don't get it. safe_mode is off. There's nothing in disable_functions. The directory is owned by www-data (the apache user on my Ubuntu system). I get a valid status back from exec() and system() and running the same command from the command line give me tons of output. I feel like I must be missing something obvious but I have no idea what it is.

    Help. Please.

  • creating Chrome compatible .mp4 with ffmpeg from commandline

    22 novembre 2012, par Baxter

    How do you encode en .mp4 file from commandline with ffmpeg, so it works in chrome? This can be really challenging, because ffmpeg has a lot of parameter combinations and Chrome are sensitive to the color encoding of the output format.

  • Invalid data found when processing input

    22 novembre 2012, par user1726619

    I want to use ffmpeg lib in my library.For that purpose,i have successfully compiled it.The input video is otherwise running fine,but when i try to execute any command,i am getting this message:

    Invalid data found when processing input.
    

    I don't know whats the reason behind it.This is the code:

     public class Videokit extends Activity {
            String FilePath;
            String OutPut;
            Context mycontext;
            Videokit vk ;
            static 
            {
                System.loadLibrary("videokit");
            }
    
            public native void run(String[] args);
    
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                FilePath =Environment.getExternalStorageDirectory().toString()+"/output.3gp";
                try {
                    ffmpegrun();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
    
            public String ffmpegrun() throws IOException
            {
                boolean success=false;
                File folder = new File(Environment.getExternalStorageDirectory().toString() + "/image-%3d.jpeg");
                File file = new File(FilePath);
                System.out.println("filepath exists at:"+file.getAbsolutePath());
                if (!folder.exists()) {
                    success = folder.mkdirs();
        //              Toast.makeText(mycontext,"outfile.mp4 exists at"+folder.getAbsolutePath(),Toast.LENGTH_LONG).show();
                     OutPut = folder.getAbsolutePath();
                }
                System.out.println("outfile.flv exists at:"+folder.getAbsolutePath());
                run(new String[]{
                        "ffmpeg",
                        "-i",
                        FilePath,
                        "-r 1", 
                         "-f",
                         "image2",
                         "image-%3d.jpeg"
                }); 
                return OutPut;
            }
        }
    

    This is the log :

    10-07 17:00:03.707: D/dalvikvm(8760): Trying to load lib /data/data/uk.co.halfninja.videokit/lib/libvideokit.so 0x44e8c958
    10-07 17:00:03.837: D/dalvikvm(8760): Added shared lib /data/data/uk.co.halfninja.videokit/lib/libvideokit.so 0x44e8c958
    10-07 17:00:03.837: I/Videokit(8760): Loading native library compiled at 13:52:27 Oct  7 2012
    10-07 17:00:03.917: I/System.out(8760): filepath exists at:/sdcard/output.3gp
    10-07 17:00:03.917: I/System.out(8760): outfile.flv exists at:/sdcard/image-%3d.jpeg
    10-07 17:00:03.917: D/dalvikvm(8760): +++ not scanning '/system/lib/libwebcore.so' for 'run' (wrong CL)
    10-07 17:00:03.917: D/dalvikvm(8760): +++ not scanning '/system/lib/libmedia_jni.so' for 'run' (wrong CL)
    10-07 17:00:03.928: D/dalvikvm(8760): +++ not scanning '/system/lib/libexif.so' for 'run' (wrong CL)
    10-07 17:00:03.928: D/Videokit(8760): run() called
    10-07 17:00:03.928: D/Videokit(8760): run passing off to main()
    10-07 17:00:03.928: D/Videokit(8760): main(): registering all modules
    10-07 17:00:03.938: D/Videokit(8760): main(): registered everything
    10-07 17:00:03.938: D/Videokit(8760): main(): initting opts
    10-07 17:00:03.968: D/Videokit(8760): main(): initted opts.
    10-07 17:00:03.968: E/Videokit(8760): ffmpeg version N-30996-gf925b24, Copyright (c) 2000-2011 the FFmpeg developers
    10-07 17:00:03.979: E/Videokit(8760):   built on Oct  7 2012 13:52:32 with gcc 4.4.3
    10-07 17:00:03.979: E/Videokit(8760):   configuration: --enable-cross-compile --arch=arm5te --enable-armv5te --target-os=linux --disable-stripping --prefix=../output --disable-neon --enable-version3 --disable-shared --enable-static --enable-gpl --enable-memalign-hack --cc=arm-linux-androideabi-gcc --ld=arm-linux-androideabi-ld --extra-cflags='-fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated' --disable-everything --enable-decoder=mjpeg --enable-demuxer=mjpeg --enable-parser=mjpeg --enable-demuxer=image2 --enable-muxer=mp4 --enable-encoder=libx264 --enable-libx264 --enable-decoder=rawvideo --enable-protocol=file --enable-hwaccels --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-filter=buffer --enable-filter=buffersink --disable-demuxer=v4l --disable-demuxer=v4l2 --disable-indev=v4l --disable-indev=v4l2 --extra-cflags='-I../x264 -Ivideokit' --extra-ldflags=-L../x264
    10-07 17:00:03.987: D/Videokit(8760): main(): parsing options
    10-07 17:00:03.987: D/Videokit(8760): parse_options has 7 options to parse
    10-07 17:00:04.050: E/Videokit(8760): /sdcard/output.3gp: Invalid data found when processing input
    10-07 17:00:04.050: E/Videokit(8760): ffmpeg_exit(1) called!
    

    Please help me.I am clueless about this problem.Thanks in advance.