Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • PHP : How to stream blank video ?

    15 mai 2019, par Marc

    How do I create and stream a blank video with duration pass to url like this:

    
    

    It should play a black screen video for 8 seconds. Is this possible?

  • Video file not trimming and copying using FFMpeg in C#

    15 mai 2019, par chapperzuk

    I am trying to clip a video using C# in Visual Studios with FFMpeg. I run the code below and it doesn't come back with any errors, except it doesn't create a new video file.

    I've looked around here to make sure I'm using the correct code, but after multiple attempts it still won't copy.

    string videoFile = @"C:\Users\dave\Documents\video 1.mp4";
    string outputFile = @"C:\Users\dave\Documents\video 2.mp4";
    
    Process process = new Process();
    process.StartInfo.RedirectStandardOutput = true;
    process.StartInfo.RedirectStandardError = true;
    process.StartInfo.FileName = @"C:\Users\dave\Documents\ffmpeg.exe";
    process.StartInfo.Arguments = "ffmpeg -i " + videoFile + " -ss 00:30:00 -t 00:00:10 -c copy " + outputFile;
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.CreateNoWindow = true;
    process.Start();
    

    I was expecting to get a video cut from the original video, starting at the 30 second mark and lasting 10 seconds, but nothing is created.

    I am using the latest FFMpeg from https://ffmpeg.zeranoe.com/builds/

    UPDATE If I run the code in command prompt - The file comes out corrupt though

    ffmpeg -i "C:\\Users\\dave\\Documents\\video 1.mp4" -ss 00:30:00 -t 00:00:10 -c copy "C:\\Users\\dave\\Documents\\video 2.mp4"
    ffmpeg version N-93851-gdcc999819d Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 8.3.1 (GCC) 20190414
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
      libavutil      56. 27.100 / 56. 27.100
      libavcodec     58. 52.101 / 58. 52.101
      libavformat    58. 27.103 / 58. 27.103
      libavdevice    58.  7.100 / 58.  7.100
      libavfilter     7. 51.100 /  7. 51.100
      libswscale      5.  4.101 /  5.  4.101
      libswresample   3.  4.100 /  3.  4.100
      libpostproc    55.  4.100 / 55.  4.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\\Users\\dave\\Documents\\video 1.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2mp41
        creation_time   : 2019-01-15T21:57:04.000000Z
        title           : My Movie
        encoder         : Lavf56.15.102
        description     : This video is about My Movie
      Duration: 00:06:48.22, start: 0.000000, bitrate: 1283 kb/s
        Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 1202 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 2997 tbc (default)
        Metadata:
          creation_time   : 2019-01-15T21:57:04.000000Z
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 74 kb/s (default)
        Metadata:
          creation_time   : 2019-01-15T21:57:04.000000Z
          handler_name    : SoundHandler
    Output #0, mp4, to 'C:\\Users\\dave\\Documents\\video 2.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2mp41
        description     : This video is about My Movie
        title           : My Movie
        encoder         : Lavf58.27.103
        Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 1202 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 11988 tbc (default)
        Metadata:
          creation_time   : 2019-01-15T21:57:04.000000Z
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 74 kb/s (default)
        Metadata:
          creation_time   : 2019-01-15T21:57:04.000000Z
          handler_name    : SoundHandler
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    frame=    0 fps=0.0 q=-1.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
    video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    
  • ffmpeg Image2pipe command Stuck infinitely while taking image stream from PhantomJS

    15 mai 2019, par Link2 Video

    Let me Explain by my Code what issue i am facing...

    This is my js file for using with PhantomJS. It simple tell it to open a page and take screenshots of it and store them in stdout.

    var page = require("webpage").create();
    page.viewportSize = { width: 640, height: 480 };
    page.open("http://www.goodboydigital.com/pixijs/examples/12-2/", function() {
    setInterval(function() {
    page.render("/dev/stdout", { format: "png" });
    }, 25);
    });
    

    And this is the cmd command I'm running to receive the captured images in ffmpeg in Windows Command Prompt.

    phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 25 -t 10  -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart dragon.mp4
    

    This command successfully starts the processes of PhantomJS and ffmpeg. But nothing happens for quite some time, after 15 minutes it gives an error saying:

    "Failed to reallocate parser buffer"

    thats it. I have referenced this code from this site on which the developer claims that it works https://mindthecode.com/recording-a-website-with-phantomjs-and-ffmpeg/

    Please see the attached Image for more explanation. Image of Code

  • How can I apply complex filters more than once with different parameters while avoiding "too many inputs" errors

    15 mai 2019, par Hugh Walxet

    I'm trying to apply the displace complex filter more than once in a video, at specific intervals with no proportional relationship. In each instance, I want to apply the displace filter with slightly different parameters. If I list it twice in the commands for the complex_filter, I get an error saying I have too many inputs.

    I might as well ask, separately, how I could apply the same filter with the same parameters more than once in a video, without re-iterating the same filter more than once in the command line. Put differently, how do I run a filter as specific times without writing the command several times sequentially, each with a different trigger time?

    C:\Users\Me>ffmpeg -i c:\users\Me\desktop\house2.mp4 -i c:\users\Me\desktop\house3.mp4 -i c:users\Me\desktop\house4.mp4 -filter_complex "shuffleframes=enable='between(t,21,27)':mapping=0 9 2 1 10 5 8 6 7 4 3, shuffleframes=enable='between(t,3,7)':mapping=0 4 9 1 10 5 8 6 2 7 4 3, shuffleframes=enable='between(t,15,19)':mapping=0 6 2 1 10 5 8 3 7 4 9, [0][1][2] displace=enable='between(t,9,10)':edge=wrap, [0][1][2] displace=enable='between(t,20,21)':edge=smear" c:\users\Me\desktop\houseglitch.mp4
    
  • How to apply complex filters more than once with different parameters while avoiding "too many inputs" errors in ffmpeg ?

    15 mai 2019, par Hugh Walxet

    I'm trying to apply the displace complex filter more than once in a video, at specific intervals with no proportional relationship. In each instance, I want to apply the displace filter with slightly different parameters. If I list it twice in the commands for the complex_filter, I get an error saying I have too many inputs.

    I might as well ask, separately, how I could apply the same filter with the same parameters more than once in a video, without re-iterating the same filter more than once in the command line. Put differently, how do I run a filter as specific times without writing the command several times sequentially, each with a different trigger time?

    C:\Users\Me>ffmpeg -i c:\users\Me\desktop\house2.mp4 -i c:\users\Me\desktop\house3.mp4 -i c:users\Me\desktop\house4.mp4 -filter_complex "shuffleframes=enable='between(t,21,27)':mapping=0 9 2 1 10 5 8 6 7 4 3, shuffleframes=enable='between(t,3,7)':mapping=0 4 9 1 10 5 8 6 2 7 4 3, shuffleframes=enable='between(t,15,19)':mapping=0 6 2 1 10 5 8 3 7 4 9, [0][1][2] displace=enable='between(t,9,10)':edge=wrap, [0][1][2] displace=enable='between(t,20,21)':edge=smear" c:\users\Me\desktop\houseglitch.mp4