Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffmpeg not converting via PHP script

    16 mars 2014, par user3331834

    Essentially, I have this code:

    if(in_array($ext,$audio)&&($ext!=="flac")){
        exec("ffmpeg -i -loglevel 'verbose' ".$fileName.".".$ext." ".$fileName.".flac null >/dev/null 2>/var/www/resources/ffmpegAudio.log &",$ffmpegOutput);
        print_r($ffmpegOutput);
        $editApproveStatus="Audio entry approved. File converted.";
    }
    

    Ultimately, my goal is to convert files and show a live progress of the conversion (or at least something that updates every few seconds), and running in the background, so that the same page can be used to convert further files.

    Now I'm already stuck, because the conversion just isn't working. I know that the preceding code should be fine, since it makes it all the way to this if statement above, and no errors are being throw up by the PHP. However, my log output shows:

    ffmpeg version 0.8.10-6:0.8.10-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
      built on Feb  6 2014 20:59:46 with gcc 4.8.1
    *** THIS PROGRAM IS DEPRECATED ***
    This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
    -loglevel: No such file or directory
    

    Which also leads me to another question: If ffmpeg is deprecated, and avconv is the way to do, can I still use the exec code in my PHP as is (replacing the ffmpeg bit with avconv)? From what I've seen so far on the avconv page, it looks similar, but I can't be certain that it's exactly the same.

    So my two questions: Why isn't the file being converted, and is there any change in the syntax between avconv and ffmpeg?

  • screen mess when change video on rtmp

    16 mars 2014, par dingyaguang117
    1. when I use "ffmpeg -i" to probe video info, the infos below will be shown (take 2 examples)

      Stream #0:0: Video: h264 (High), yuv420p, 600x352, 281 kb/s, 29.97 tbr, 1k tbn, 59.94 tbc
      Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 532 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc
      

      What does the "avc1" mean?why the first doesn't shown?

      Will it be "screen mess","no sound" or "no image" when switch the video that is publishing to rtmp server if the contiguous video encode by different codec?

    2. How to switch video publishing to rtmp smoothly ? I use nginx-rtmp-module,set "live on",and use "ffmpeg -re" to publish video. My method to switch video is to "pkill ffmpeg", and start another "ffmpeg -re" process. If the contiguous videos encode by different codec,it maybe "screen mess","no sound" or "no image". What can I do to solve it?

    3. Are there any experiences(about tools,switch videos,how to choose encoding) when doing live video?

  • Returning a success or failure from ffmpeg

    16 mars 2014, par user3331834

    I have some code executed in PHP after meeting some criteria through if/then statements which looks something like this:

    if(in_array($ext,$video)&&($ext!=="mp4")){
        exec("ffmpeg -i ".$fileName.".".$ext." -s 640x360 ".$fileName.".mp4");
        /*
        if(successful){
            unlink($fileName.$ext);
            $status="Video entry approved. File converted.";
        }
        */
    }
    

    As you can see, the issue I'm having is trying to figure out what should go in place of if(successful). The point of this section of the code is to check the files extension against an array of known extensions that are in video format, and that aren't already in the mp4 format. If it passes this check, ffmpeg should run and convert to mp4.

    So a few questions here. Firstly, how can I return a status to tell me if it is converting, succeeded, or failed? Secondly, how can this be run asynchronously? That is, if I wanted to convert multiple files, would I be able to do so? Would I be able to limit ffmpeg to ensure it does not take up all of my server's processing power and inadvertently bring the site to a grinding halt?

    Or is there a better way to go about converting files than this? I'm pretty sure my method must be crude.

    EDIT: In addition to this, how does one run ffmpeg in the background, so that the page can be closed, and/or another instance from the same page can be started up by the user for multiple simultaneous conversions? Is it possible to include a real-time progress status of each conversion?

  • Video streaming fails over rtp protocol

    16 mars 2014, par dempap

    Video streaming between Unix Server (ffmpeg) and Windows client (vlc) completed without errors.

    Server side:

    ffmpeg -f v4l2 -r 25 -i /dev/video0 http://192.168.1.114:27018/feed1.ffm
    

    Client side:

    vlc player: Media -> Open Network Stream: http://192.168.1.114:27018/test.swf

    However, video streaming has approximately 10 s. delay. For this reason, I tried using rtp instead http, but without result. Specifically, on server side I run:

    ffmpeg -f v4l2 -r 25 -i /dev/video0 rtp://192.168.1.114:27018/feed1.ffm
    

    After the stream begun, on client side I typed: rtp://@:27018 but it doesn't respond.

    What I am missing? Is there any other way I could avoid delay?

  • ffmpeg : Considers AVPixelFormat as Int ?

    16 mars 2014, par jamie_y

    I would like to use a function ff_load_image.

    program.c

    #include "../ffmpeg/libavfilter/lavfutils.h"
    
    int main ()
    {
      uint8_t* data;
    
      int linesize, width, height, log_ctx;
    
      int i = ff_load_image(&data, &linesize, &width, &height, AV_PIX_FMT_RGB24, "blue.jpg", &log_ctx);
    }
    

    This compiles, but gives a warning.

    program.c: In function 'main':
    program.c:11: warning: passing argument 5 of 'ff_load_image' makes pointer from integer without a cast
    ../ffmpeg/libavfilter/lavfutils.h:39: note: expected 'enum AVPixelFormat *' but argument is of type 'int'
    

    When I run the program, it segment faults. I can't think of any other way to specify a pixel format. Why would ffmpeg think AV_PIX_FMT_RGB8 is an integer? It's obviously an AVPixelFormat.