Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffmpeg records 5 frames per second on a device that cheese records at 20 fps

    7 juillet 2017, par David Parks

    Running the following ffmpeg capture on my built in webcam:

    ffmpeg -f v4l2 -framerate 30 -video_size 1920x1080 -i /dev/video0 output.mkv
    

    I get only 5 fps and see this message:

    The driver changed the time per frame from 1/30 to 1/5
    

    When I record using cheese I get what looks like 20 fps on that device. And v4l2 seems to claim it can do 30 fps.

    v4l2-ctl --list-formats-ext
    ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'MJPG' (compressed)
        Name        : Motion-JPEG
            Size: Discrete 1920x1080
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 1280x720
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 800x600
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 640x480
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 640x360
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 640x480
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 160x120
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 320x240
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 640x480
                Interval: Discrete 0.033s (30.000 fps)
    
        Index       : 1
        Type        : Video Capture
        Pixel Format: 'YUYV'
        Name        : YUYV 4:2:2
            Size: Discrete 1920x1080
                Interval: Discrete 0.200s (5.000 fps)
            Size: Discrete 1280x720
                Interval: Discrete 0.100s (10.000 fps)
            Size: Discrete 800x600
                Interval: Discrete 0.050s (20.000 fps)
            Size: Discrete 640x480
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 640x360
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 640x480
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 160x120
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 320x240
                Interval: Discrete 0.033s (30.000 fps)
            Size: Discrete 640x480
                Interval: Discrete 0.033s (30.000 fps)
    

    When I run ffmpeg:

    Output #0, mjpeg, to 'output.mjpg':
      Metadata:
        encoder         : Lavf56.40.101
        Stream #0:0: Video: mjpeg, yuvj422p(pc), 1920x1080, q=2-31, 200 kb/s, 5 fps, 5 tbn, 5 tbc
        Metadata:
          encoder         : Lavc56.60.100 mjpeg
    

    My guess is that it's recording in raw form from the device and doing the encoding in ffmpeg. If this is correct, how would I get ffmpeg to use the mjpeg native format?

  • How install ffmpeg on wamp 3.0.4 x64 apache 2.4.18 mysql 5.7.11 php 5.6.19

    7 juillet 2017, par Zakaria Bouhali

    Hello I found a lot of explanations But did not benefit from them I want to install ClipBucket Any Help

  • Merge Two Videos side by side in C# Not working with large file

    7 juillet 2017, par Muhammad Zeeshan

    i am trying to merge two videos side by side using ffmpeg. it is working fine if the size of each video is less then 1 mb if it exceed from 1mb conversion process take infinite time. is there any way to make it fast or i need to change command line. here is snippet am trying

      ProcessStartInfo proce = new ProcessStartInfo("ffmpeg.exe");
            proce.WorkingDirectory = @"d:\vid";
            Process p = Process.Start(proce);
            string wavefilep = @"D:\vid\camVid1.avi";
            string videop = @"D:\vid\DeskCamVid1.avi";
            string fileout = @"D:\vid\OutPut123.avi";
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            try
            {
    
                proc.StartInfo.Arguments = string.Format(" -i {0} -i {1} -filter_complex \"[0:v:0]pad=iw*4:iw[bg]; [bg][1:v:0] overlay=h\" {2}",wavefilep,videop,fileout);
    
                proc.StartInfo.UseShellExecute = false;
                proc.StartInfo.CreateNoWindow = false;
                proc.StartInfo.RedirectStandardOutput = true;
                proc.StartInfo.RedirectStandardError = true;
                proc.StartInfo.FileName = @"d:\vid\ffmpeg.exe";
                proc.Start();
                string StdOutVideo = proc.StandardOutput.ReadToEnd();
                string StdErrVideo = proc.StandardError.ReadToEnd();
                MessageBox.Show(" video done");
    

    here is the command am using with to merge videos

    -i vidoe1.avi -i video2.avi -filter_complex "[0:v:0]pad=iw*2:ih[bg]; [bg][1:v:0]overlay=3*w" output.avi
    

    here is the output log of ffmpeg every time i run application it stuck at this frame

    ffmpeg version N-86482-gbc40674 Copyright (c) 2000-2017 the FFmpeg developers
      built with gcc 7.1.0 (GCC)
      configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
      libavutil      55. 66.100 / 55. 66.100
      libavcodec     57. 99.100 / 57. 99.100
      libavformat    57. 73.100 / 57. 73.100
      libavdevice    57.  7.100 / 57.  7.100
      libavfilter     6. 92.100 /  6. 92.100
      libswscale      4.  7.101 /  4.  7.101
      libswresample   2.  8.100 /  2.  8.100
      libpostproc    54.  6.100 / 54.  6.100
    Input #0, avi, from 'd:\vid\camVid1.avi':
      Metadata:
        encoder         : Lavf57.56.100
      Duration: 00:01:49.64, start: 0.000000, bitrate: 347 kb/s
        Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 342 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Input #1, avi, from 'd:\vid\DeskCamVid1.avi':
      Metadata:
        encoder         : Lavf57.56.100
      Duration: 00:01:48.80, start: 0.000000, bitrate: 427 kb/s
        Stream #1:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 1366x768 [SAR 1:1 DAR 683:384], 422 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    File 'd:\vid\outap.avi' already exists. Overwrite ? [y/N] Stream mapping:
      Stream #0:0 (mpeg4) -> pad
      Stream #1:0 (mpeg4) -> overlay:overlay
      overlay -> Stream #0:0 (mpeg4)
    Press [q] to stop, [?] for help
    Output #0, avi, to 'd:\vid\outap.avi':
      Metadata:
        ISFT            : Lavf57.73.100
        Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 2560x640 [SAR 1:1 DAR 4:1], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
        Metadata:
          encoder         : Lavc57.99.100 mpeg4
        Side data:
          cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    frame=   28 fps=0.0 q=31.0 size=     325kB time=00:00:03.60 bitrate= 740.3kbits/s speed=7.12x    
    frame=   59 fps= 59 q=31.0 size=     416kB time=00:00:07.72 bitrate= 441.8kbits/s speed=7.67x    
    frame=   90 fps= 60 q=31.0 size=     536kB time=00:00:11.84 bitrate= 370.8kbits/s speed=7.85x    
    frame=  121 fps= 60 q=24.8 size=     661kB time=00:00:15.96 bitrate= 339.5kbits/s speed= 7.9x    
    frame=  152 fps= 60 q=31.0 size=     762kB time=00:00:20.08 bitrate= 310.9kbits/s speed=7.96x    
    frame=  183 fps= 61 q=31.0 size=     883kB time=00:00:24.20 bitrate= 299.0kbits/s speed=   8x    
    frame=  215 fps= 61 q=31.0 size=     974kB time=00:00:28.44 bitrate= 280.6kbits/s speed=8.05x    
    frame=  246 fps= 61 q=31.0 size=    1100kB time=00:00:32.56 bitrate= 276.8kbits/s speed=8.05x    
    frame=  278 fps= 61 q=31.0 size=    1234kB time=00:00:36.80 bitrate= 274.6kbits/s speed=8.08x    
    frame=  310 fps= 61 q=31.0 size=    1327kB time=00:00:41.08 bitrate= 264.6kbits/s speed=8.13x    
    frame=  340 fps= 61 q=31.0 size=    1439kB time=00:00:45.04 bitrate= 261.7kbits/s speed=8.11x    
    frame=  371 fps= 61 q=31.0 size=    1525kB time=00:00:49.16 bitrate= 254.1kbits/s speed=8.11x    
    frame=  403 fps= 61 q=31.0 size=    1639kB time=00:00:53.44 bitrate= 251.2kbits/s speed=8.13x    
    frame=  434 fps= 61 q=31.0 size=    1753kB time=00:00:57.56 bitrate= 249.5kbits/s speed=8.14x    
    frame=  466 fps= 61 q=31.0 size=    1845kB time=00:01:01.80 bitrate= 244.6kbits/s speed=8.16x    
    frame=  497 fps= 61 q=31.0 size=    1958kB time=00:01:05.92 bitrate= 243.3kbits/s speed=8.15x  
    
  • Could not get audio( libopus ) stream from ffserver via rtp

    7 juillet 2017, par Кирилл Казаков

    I need to get the rtp stream with the next codecs vp8,opus. I get a stream from a camera (h264, aac), then I send to ffmpeg,then I send it to the ffserver and from there I want to receive a stream in the format rtp. Video (VP8) without audio i successfully get, but stream video with audio ( any codecs ( aac, vorbis, opus ) ) not work.

    ffmpeg command:

     ./ffmpeg -thread_queue_size 512 -rtsp_transport tcp -i rtsp://ip:port/stream -analyzeduration 0 -threads 2 http://localhost:4000/feed1.ffm
    

    ffserver config:

    HTTPPort 4000
    RTSPPort 1235
    
    RTSPBindAddress 0.0.0.0
    HTTPBindAddress 0.0.0.0
    MaxHTTPConnections 2000
    MaxClients 1000
    MaxBandwidth 10000
    
    
            File /tmp/feed1.ffm
            FileMaxSize 1G
            ACL allow 127.0.0.1
            ACL allow localhost
    
    
    
        Feed feed1.ffm
        Format rtp
    
        # Video settings
        VideoCodec libvpx
        VideoSize 720x576
        VideoFrameRate 25
        VideoBitRate 512
        AVOptionVideo maxrate 2000
        VideoQMin 4
        VideoQMax 50
        VideoBufferSize 4000
    
        AVOptionVideo cpu-used 3
        AVOptionVideo crf 33
        AVOptionVideo quality realtime
        AVOptionVideo flags +global_header
        #PreRoll 0
        #StartSendOnKey
    
        # Audio settings
        #AudioCodec aac
        #AudioCodec libopus
        #Strict -2
        AudioBitRate 128
        AudioChannels 2
        AudioSampleRate 48k
        AVOptionAudio flags +global_header
    
        ACL allow localhost
    
    

    And without video (only audio) - not worked

    HTTPPort 4000
    RTSPPort 1235
    
    RTSPBindAddress 0.0.0.0
    HTTPBindAddress 0.0.0.0
    MaxHTTPConnections 2000
    MaxClients 1000
    MaxBandwidth 10000
    
    
            File /tmp/feed1.ffm
            FileMaxSize 1G
            ACL allow 127.0.0.1
            ACL allow localhost
    
    
    
        Feed feed1.ffm
        Format rtp
    
        # Video settings
        NoVideo
    
        # Audio settings
        #AudioCodec aac
        #AudioCodec libopus
        #Strict -2
        AudioBitRate 128
        AudioChannels 2
        AudioSampleRate 48k
        AVOptionAudio flags +global_header
    
        ACL allow localhost
    
    

    I try to connect to my stream via vlc, but i see error in vlc ( if audio libopus) core error: could not identify codec, if audio codec (e.g. aac ) - live555 error: no data received in 10s, aborting .

    ffserver info build:

    ffserver version N-86676-g45dbb40cd1-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
      built with gcc 5.4.1 (Debian 5.4.1-11) 20170519
      configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
      libavutil      55. 67.100 / 55. 67.100
      libavcodec     57.100.102 / 57.100.102
      libavformat    57. 75.100 / 57. 75.100
      libavdevice    57.  7.100 / 57.  7.100
      libavfilter     6. 94.100 /  6. 94.100
      libswscale      4.  7.101 /  4.  7.101
      libswresample   2.  8.100 /  2.  8.100
      libpostproc    54.  6.100 / 54.  6.100
    

    ffmpeg info build:

    ffmpeg version N-86676-g45dbb40cd1-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
      built with gcc 5.4.1 (Debian 5.4.1-11) 20170519
      configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
      libavutil      55. 67.100 / 55. 67.100
      libavcodec     57.100.102 / 57.100.102
      libavformat    57. 75.100 / 57. 75.100
      libavdevice    57.  7.100 / 57.  7.100
      libavfilter     6. 94.100 /  6. 94.100
      libswscale      4.  7.101 /  4.  7.101
      libswresample   2.  8.100 /  2.  8.100
      libpostproc    54.  6.100 / 54.  6.100
    

    What a problem ? Any idea? .

  • Android Screen mirroring via rtsp server

    7 juillet 2017, par Anıl Mert Ar

    I was trying to mirror my android phone's screen to my PC. I actually did that thanks to ffplay and adb. But my question is how I can send it to an rtsp server. Do I need any additional stuff besides them?

    What I can do :

    adb exec-out screenrecord --output-format=h264 - | ffplay -
    

    I completely didn't understand how to send this output to an rtsp server and I don't know if there is additional thing rather than rtsp I will be so appreciated if you help me. Thanks.