Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFMPEG not creating thumbnails

    12 juin 2016, par MixedVeg

    My ffmpeg command in php is

    echo $cmd_thumbnail_create = ("\"$ffmpeg\" -i \"" . $dir.$videopath . "\" -an -ss $getFromSecond \"" . $dir.$thumbnailpath ."\"");
    exec($cmd_thumbnail_create);
    

    Output of which is

    "C:\FFMPEG\bin\ffmpeg" -i "C:/xampp/htdocs/final/uploaded_videos/intro_en.mp4" -an -ss 6 "C:/xampp/htdocs/final/thumbnail/intro_en.jpg"

    This when copied and executed on the command prompt creates the thumbnail at proper location with proper name.

    Any suggestions?

  • Calculate frames to remove to get timelapse of desired length

    12 juin 2016, par Espen Birk

    I've got lots of images stored on a server, and a reference in a MySQL database so that i can easily query it for image from specific dates/time.

    Images is taken with an interval of 7 images/hour.

    Lets say i want to create a timelapse from the last 4 days, and make a 5 sec movie. How can i calculate how to evenly drop frames to get to that desired length of 5 seconds?

    This is what i got so far.

    Total images: 4 Days * 24 hours * 7 images/hour = 672 images Required images at 24 fps: 24 * 5 = 120 images

    Divide the total images with the required images to find out which/every frame i need to keep

    672 / 120 = 5.6

    Then i loop trough all 672 images, and every 5th or 6th time i store a reference to the image in an array.

    Here is my problem. If i round up i get a video thats longer than i want, and if i round down i get a video thats shorter.

    If i keep every 5th image when looping: 134 images / 24 fps = 5.6 sec video If i keep every 6th image when looping: 112 images / 24 fps = 4.6 sec video

    Is it possible to get it better, and still skip images evenly?

    Solved this using xxfelixxx's answer in PHP Heres the code in PHP:

    $start  = 1;
    $stop   = 672; // Total Images
    
    $dur    = 5;   // Video Duration
    $n      = 24 * $dur; // Required frames - 24 FPS * Duration
    $next   = $start;
    $step = ( $stop - $start ) / $n;
    
    $frames = array();
    
    for ($i = 1; $i <= $n; $i++) {
        $frames[] = round($next);
        $next += $step;
    };
    
    var_dump($frames);
    
  • Convert live flv rtmp to hls with FFMPEG

    12 juin 2016, par mikel atef

    Ubuntu with rtmp nginx start live flv audio

    but it's not working with Android browsers

    ffmpeg -y -loglevel warning -f dshow -i video="screen-capture-recorder" -vf crop=690:388:136:0 -r 30 -s 962x388 -threads 2 -vcodec libx264 -vpre baseline -vpre my_ffpreset -f flv rtmp:///live/myStream.sdp
    
  • stream with ffmpeg multiple input in one output

    12 juin 2016, par Gloytos htyqo

    i have a folder with lot of mp4 videos and i want to stream those to my rtmp server. i use this command

    for i in /var/www/html/VIDEO/*.mp4; do ffmpeg -re -i $i -vcodec h264 -crf 25 -preset veryfast -maxrate 650k -bufsize 650k -aspect '640:360' -s '640:360' -acodec libfdk_aac -f flv rtmp://rtmp.example.com/live/video; done
    

    but it have problem after ffmpeg stream next file coz there is problem when i want to play it

    PTS 4294794919, next:104020298 invalid dropping st:0 DTS 4294794943, next:104041631 st:0 invalid dropping PTS 4294794943, next:104041631 invalid dropping st:0

  • Concatenating mp4 files

    12 juin 2016, par user6162407

    Using ffmpeg, I'm concatenating 4 videos written in the txt file.

    ffmpeg -f concat -i vid.txt -c copy output.mp4
    

    What is returned.

    Non-monotonous DTS in output stream 0:0; previous: 397911, current: 11823; changing to 397912. This may result in incorrect timestamps in the output file.

    And the ouput file having delays of audio and visual data.