Recherche avancée

Médias (0)

Mot : - Tags -/configuration

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (108)

Sur d’autres sites (15584)

  • PHP - FFMPEG - Unable to apply multiple regular expressions on media output

    9 avril 2012, par Parth G

    I am writing a php script (I have to use php) to cycle through a dir of media files and displaying media information in a chart.

    Right now, I'm trying to do it on 1 file.

    I can successfully do so. I currently can parse the output (using regular expressions) to obtain information such as file name, duration, resolution, etc

    I was told that I can combine the regular expressions to make it more efficient.

    When I do however, I am unable to parse the ffmpeg output correctly.

    Consequently, I've tried copying the output to a string and parsing that using multiple expressions and it works just fine.

    Any help is appreciated.

    Thanks.


    Working code

    $media_info = "'test.mkv': Metadata: creation_time : 2011-03-12 09:04:18 Duration: 00:21:44.10, start: 0.000000, bitrate: 500 kb/s Chapter #0.0: start 0.097000, end 1304.107000 Metadata: title : 00:00:00.097 Stream #0:0: Video: h264 (High), yuv420p, 720x400 [SAR 80:81 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) Stream #0:1: Audio: aac, 48000 Hz, stereo, s16 (default) At least one output file must be specified";


    $file = array();
    $file_test = preg_match_all("/'([a-zA-Z0-9\._]*\.[a-zA-Z0-9]*)'.* Duration: ([0-9]{2,}:[0-9]{2}:[0-9]{2}\.[0-9]*)/", $media_info, $file);;
    var_dump($file)

    Not Working Code

    ob_start();
    passthru("C:\\wamp\\www\\ffmpeg\\bin\\ffmpeg.exe -i \"{$videofile}\" 2>&1");
    $raw_data = ob_get_contents();
    ob_end_clean();


    $ffmpeg_info =  explode("from", $raw_data);


    $media_info = $ffmpeg_info[1];

    $file = array();
    $file_test = preg_match_all("/'([a-zA-Z0-9\._]*\.[a-zA-Z0-9]*)'.* Duration: ([0-9]{2,}:[0-9]{2}:[0-9]{2}\.[0-9]*)/", $media_info, $file);;
    var_dump($file)

    New Code

    I tried using the ffmpeg-php extension and the following works (except for printing the bit rate)

    $movie = new ffmpeg_movie($video_file);

    echo $movie->getFilename();
    echo "<br />" ;
    echo $movie->getDuration();
    echo "<br />" ;
    echo $movie->getFrameWidth();
    echo "x";
    echo $movie->getFrameHeight();
    echo "<br />" ;
    echo $movie->getBitRate();
    echo "<br />" ;
    echo $movie->getVideoBitRate();
    echo "<br />" ;
    echo $movie->getAudioBitRate();
    echo "<br />" ;
    echo $movie->getVideoCodec();
    echo "<br />" ;
    echo $movie->getAudioCodec();
    ?>
  • Code to combine multiple media files using ffmpeg

    21 mars 2013, par user2193172

    I am new to ffmpeg

    I am trying to combine multiple media files using ffmpeg, I know the ffmpeg concatenation protocol allows this through a command line arguement. I want to know if the C code for this function is available anywhere, so that I can include the same in my program. If not, I would really appreciate if someone could post any suggestions on how to do this. Basically, I want to combine multiple files without doing the decoding and encoding of files.

    I tried copying the data from one file to another, while I was able to create a new file, i couldn't play it back.

    I searched the ffmpeg library but was unable to locate the code on how the concatenation function works.

  • Segmenting media files with FFMPEG

    2 mai 2012, par Luuk D. Jansen

    In the newer releases of FFMPEG it is supposed to be possible to segment media files.
    I checked out the SVN with

    svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg

    However, after building and trying to segment with the command below I get the error :

    Unrecognized option &#39;segment_time&#39;

    Is there a specific ./configure option needed or a specific branch ?
    There is nothing mentioned in FFMPEG manual (neither which version supports it). I would prefer to use a pre-build production version if possible.

    Command used to test :

    ffmpeg -v 9 -loglevel 99 -re -i test.mov -an -c copy -b:v 128k -flags -global_header -map 0 -f segment -segment_time 4 -segment_list test.m3u8 -segment_format mpegts stream%05d.ts