Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • look for a mp4 file inside a directory and send it to different directory after converting to mp3 in php ?

    13 mai 2019, par flash

    I have a directory called incoming_folder in which there is a mp4 file.

    What I want to achieve through php code is to scan a incoming_folder directory, look for an mp4 file and send it to outgoing_folder after converting it into mp3.

    Technically outgoing_folder should have mp3 version of mp4 from incoming_folder

    Here is the pictorial representation of what I want:

    enter image description here

    Tried with the following code although its scanning the incoming_folder directory but no conversion is happening through ffmpeg.

    <?php
    $dir    = 'in_folder';  /* Place where mp4 file is present */
    $files1 = scandir($dir);
    print_r($files1);    /* It lists all the files in a directory including mp4 file*/
    
    $destination = 'out_folder';  /* Place where mp3 file need to be send after conversion from mp4 */
    
        <?php
        foreach($files1 as $f)
        {
          $parts = pathinfo($f);
    
          switch($parts['extension'])
          {
            case 'mp4' :
              system('ffmpeg -i '.$f.' -map 0:2 -ac 1 '.$destination.DS. $parts['filename'].'.mp3', $result);
    
              if ($result) {
                // Do something with result if you want
                // log for example
              }
              break;
    
            case 'mp3' :
              // copy($f, $destination. DS . $parts['filename']. '.' . $parts['extension']);
              copy($f, $destination.DS.$parts['filename'].'.mp3');
              break;  
          }
        }
        ?>
    

    Problem Statement:

    I am wondering what changes I should make in the php code so that conversion of file happens from incoming_folder and it should go to outgoing_folder.

  • How to add zoom transition effects using FFmpeg to a variable number of images ?

    13 mai 2019, par Mathematics

    How can I add add zoom transition effects using FFmpeg to a variable number of images?

    I am able to create video from a variable number of images but I am not sure how to add zoom in and out transition effects between images:

     ffmpeg -framerate 1/5 -i img%03d.jpeg -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
    

    I found this,

    https://superuser.com/questions/1189246/ffmpeg-image-slideshow-with-zoompan-and-fade-in-out/1190199

    But problem is that images are hard coded in that example and I am not sure how to make it work for a variable number of images?

  • Convert long video to 16:9 by blurring sides ?

    13 mai 2019, par JackChap77

    I am taking screenshots in python using selenium and want to convert them to a video. At the moment I have a black border around the top and bottom but I want it to be a blured image of the video in the background (the video is just a still image and audio)

    Used the filter from https://stackoverflow.com/a/30832903/8502422 but it returns 'invalid too big or non positive size'

    ffmpeg -loop 1 -i image.png -i audio.mp3 -c:v libx264 -preset veryslow -crf 0 -c:a copy -lavfi "[0:v]scale=iw:2*trunc(iw*16/18),boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,setsar=1" -shortest post.mp4
    
  • How To Make Make A Video File From Images Using FFMPEG If Your Images Start At A Random Number [duplicate]

    13 mai 2019, par teot 59

    So I am making a program on my raspberry pi and I am constantly saving pictures in the background and deleting them. So for instance in the images folder I have images from 123.png to 234.png

    for now I have been using this command:

    os.system("ffmpeg -f image2 -r 15 -pattern_type glob -i 'videos/*.png' -vcodec mpeg4 -y movie.avi")
    

    But it's unreliable, because it mixes image numbers up

    (sorry for bad English)

  • FFmpeg : Remux f4v cutted from stream to mp4

    13 mai 2019, par Martin

    I have a mp4 file cutted from a H.264/AAC stream with Wowza Media Server. After the cutting, the file was forced to mp4 format with the following command:

    ffmpeg -i wowza_output_file -vcodec copy -acodec copy -f mp4 -y wowza_output_file_copy
    

    From there I renamed it to test_f4v.mp4 and took ffprobe, to take a look at the file:

    ffprobe version 0.8, Copyright (c) 2007-2011 the FFmpeg developers
      built on Jul 20 2011 13:32:19 with gcc 4.4.3
      configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264
      libavutil    51.  9. 1 / 51.  9. 1
      libavcodec   53.  7. 0 / 53.  7. 0
      libavformat  53.  4. 0 / 53.  4. 0
      libavdevice  53.  1. 1 / 53.  1. 1
      libavfilter   2. 23. 0 /  2. 23. 0
      libswscale    2.  0. 0 /  2.  0. 0
      libpostproc  51.  2. 0 / 51.  2. 0
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_f4v.mp4':
      Metadata:
        major_brand     : f4v 
        minor_version   : 0
        compatible_brands: isommp42m4v 
        creation_time   : 2012-04-23 12:36:06
      Duration: 01:00:01.84, start: 0.000000, bitrate: 2004 kb/s
        Stream #0.0(eng): Video: h264 (Baseline), yuv420p, 854x480 [PAR 1:1 DAR 427:240], 1903 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
        Metadata:
          creation_time   : 2012-04-23 12:36:06
        Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 96 kb/s
        Metadata:
          creation_time   : 2012-04-23 12:36:06
    

    Now there is a problem. I need a file, which has the following meta data:

    major_brand     : mp42
    compatible_brands: isom
    

    Is there a way to remux the mp4 file to get the major_brand and compatible_brands to the described values with ffmpeg?