Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Electron ffmpeg integration

    27 avril 2017, par Raider Dave

    I am in way over my head here. I am normally a coldfusion/javascript/jquery developer but now have taken on a task that assumes I know more than I do.

    I am trying to write an application in electron that will allow me to select a group of video files and convert them to mp4 files while also compressing them. The files are football plays and a normal game consists of about 160 plays and 18gb. We need to compress these down to about 4gb. I have used programs like Prism to do this, but the intended users are not technically savvy nor do they all have windows - some have Macs.

    I have an electron project that I have started and got the first part to work. I can start the app and select the input files. But I have tried all kinds of different solutions found online to call ffmpeg and pass it the parms to convert a file. Is there an easy way to call ffmpeg with parms and then wait for it to finish before continuing?

    I am on Windows 10 but will also need to run on Apple OS. Please, if you have a simple example of how to do this, I would appreciate it.

    Thanks! Dave

  • ffmpeg and ffserver, rc buffer underflow ?

    26 avril 2017, par Dove Devic

    I am attempting to write a simple streaming server for a project. I have an AWS Linux machine that will be running ffserver. Curently, as it stands, my config file looks like the following:

    #Server Configs
    HTTPPort 8090
    HTTPBindAddress 0.0.0.0
    MaxHTTPConnections 2000
    MaxClients 1000
    MaxBandwidth 1000
    CustomLog -
    
    #Create a Status Page
    
    Format status
    ACL allow localhost
    ACL allow 255.255.255.255 #Allow everyone to view status, for now
    
    
    #Creates feed, only allow from self
    
    File /tmp/feed1.ffm
    FileMaxSize 50M
    ACL allow 127.0.0.1
    ACL allow 
    
    
    #Creates stream, allow everyone
    
    Format mpeg
    Feed feed1.ffm
    VideoFrameRate 30
    VideoSize 640x480
    AudioSampleRate 44100
    
    

    I then am capturing my Webcam and sending it up to the server using the following command:

    ffmpeg -f dshow 
           -i video="Webcam C170":audio="Microphone (Webcam C170)" 
           -b:v 1400k  
           -maxrate 2400k  
           -bufsize 1200k  
           -ab 64k  
           -s 640x480  
           -ac 1  
           -ar 44100  
           -y http://:8090/feed1.ffm
    

    When I run this however, I get the following output from my console:

    Guessed Channel Layout for  Input Stream #0.1 : stereo
    Input #0, dshow, from 'video=Webcam C170:audio=Microphone (Webcam C170)':
      Duration: N/A, start: 12547.408000, bitrate: N/A
        Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 30 tbr, 10000k tbn, 30 tbc
        Stream #0:1: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
    Output #0, ffm, to ':8090/feed1.ffm':
      Metadata:
        creation_time   : 2017-04-26 14:55:27
        encoder         : Lavf57.25.100
        Stream #0:0: Audio: mp2, 44100 Hz, mono, s16, 64 kb/s
        Metadata:
          encoder         : Lavc57.24.102 mp2
        Stream #0:1: Video: mpeg1video, yuv420p, 640x480, q=2-31, 64 kb/s, 30 fps, 1000k tbn, 30 tbc
        Metadata:
          encoder         : Lavc57.24.102 mpeg1video
        Side data:
          unknown side data type 10 (24 bytes)
    Stream mapping:
      Stream #0:1 -> #0:0 (pcm_s16le (native) -> mp2 (native))
      Stream #0:0 -> #0:1 (rawvideo (native) -> mpeg1video (native))
    Press [q] to stop, [?] for help
    [mpeg1video @ 02e95180] rc buffer underflow
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflow
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflow
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflow
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflow
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflow
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflow
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflow
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflowtime=00:00:01.13 bitrate= 404.8kbits/s dup=13 drop=0 speed=2.22x
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflow
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflowtime=00:00:01.63 bitrate= 361.1kbits/s dup=13 drop=0 speed=1.61x
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflowtime=00:00:02.13 bitrate= 368.6kbits/s dup=13 drop=0 speed= 1.4x
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflowtime=00:00:02.66 bitrate= 344.1kbits/s dup=13 drop=0 speed=1.32x
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflowtime=00:00:03.16 bitrate= 331.1kbits/s dup=13 drop=0 speed=1.25x
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    [mpeg1video @ 02e95180] rc buffer underflow
    [mpeg1video @ 02e95180] max bitrate possibly too small or try trellis with large lmax or increase qmax
    frame=  117 fps= 36 q=31.0 Lsize=     156kB time=00:00:03.86 bitrate= 330.5kbits/s dup=13 drop=0 speed= 1.2x
    video:118kB audio:27kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.659440%
    Exiting normally, received signal 2.
    

    And on my viewer, I just get a black screen.

    Is there something I'm missing? Searching lead to nothing on "increasing qmax" or anything similar to what ffmpeg complained about. There have been questions asked here, but nothing has been done/answered.

    Thanks in advance

  • Opening video from file using OpenCV in Python

    26 avril 2017, par Noise in the street

    I am trying to use OpenCV2 with my Conda environment for Python 2.7.

    My installation was basically the same as what was described in this question.

    I retrieved OpenCV like so:

    conda install --channel https://conda.anaconda.org/menpo opencv3
    

    I can import the library cv2 and print the version, which is 3.1.0. So far so good. I can even load an image and display it:

    import cv2
    
    img = cv2.imread('desertfloor.jpg')
    cv2.imshow('foo',img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    

    This works just fine. But when I go to load a video in the same directory:

    vid = cv2.VideoCapture('bbb.avi') # Big Buck Bunny
    returnval,frame = vid.read()
    print returnval
    

    The returned value is False, which tells me that the frame wasn't returned correctly. When I check vid.isOpened(), it is False as well. Since it doesn't return an error, it's really hard to tell what's going on. I've heard that ffmpeg can cause some issues if it's not installed properly (whatever that means), but I can't tell if that's what's going on here.

    Can anyone tell me why the video isn't opening properly?

  • opencv_ffmpeg2413_64.dll Linux build for OpenCV

    26 avril 2017, par ilatif28

    I am using opencv2413 for image processing and camera capture. My code runs fine on windows where i used windows build of opencv. With opencv you have to dynamically load some dll's such as System.loadLibrary(Core.NATIVE_LIBRARY_NAME); System.loadLibrary("opencv_ffmpeg2413_64"); however, when i use the same code on Linux with Java7 its complains because of DLLs. I am looking for replacement which i found for Core.NATIVE_LIBRARY_NAME the SO file but i cant find foropencv_ffmpeg2413_64.dll. Any advice how create/find that SO or do i have to change it to different library for camera capture? Thanks

  • ffmpeg doesn't correctly work with mkv

    26 avril 2017, par Alex

    Now I'm trying to trim mkv file with ffmpeg command.

    ffmpeg -y -i 1.mkv -filter_complex "[0:0]trim=start=201:duration=28,setpts=PTS-STARTPTS" a.mp4
    

    after processing a.mp4 is created with length(28s), but there is problems.

    1. Video is some flapped while playing.
    2. Audio is continued though playing has ended beyond 28s.

    So could you guys tell me what can I do?

    When ffmpeg processing, it shows some errors as like this:

    D:\Work\ffmpeg\files> ffmpeg -y -i 1.mkv -filter_complex "[0:0]trim=start=201:duration=28,setpts=PTS-STARTPTS" a.mp4
    ffmpeg version N-77883-gd7c75a5 Copyright (c) 2000-2016 the FFmpeg developers
      built with gcc 5.2.0 (GCC)
      configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
      libavutil      55. 13.100 / 55. 13.100
      libavcodec     57. 22.100 / 57. 22.100
      libavformat    57. 21.101 / 57. 21.101
      libavdevice    57.  0.100 / 57.  0.100
      libavfilter     6. 25.100 /  6. 25.100
      libswscale      4.  0.100 /  4.  0.100
      libswresample   2.  0.101 /  2.  0.101
      libpostproc    54.  0.100 / 54.  0.100
    Guessed Channel Layout for  Input Stream #0.1 : mono
    Input #0, matroska,webm, from '1.mkv':
      Metadata:
        ENCODER         : Lavf56.1.0
      Duration: 00:35:40.08, start: 0.000000, bitrate: 348 kb/s
        Stream #0:0: Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc
        Stream #0:1: Audio: pcm_mulaw ([7][0][0][0] / 0x0007), 8000 Hz, 1 channels, s16, 64 kb/s
    [libx264 @ 000002859baf3300] using SAR=1/1
    [libx264 @ 000002859baf3300] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 000002859baf3300] profile High, level 3.0
    [libx264 @ 000002859baf3300] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'a.mp4':
      Metadata:
        encoder         : Lavf57.21.101
        Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
        Metadata:
          encoder         : Lavc57.22.100 libx264
        Side data:
          unknown side data type 10 (24 bytes)
        Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 8000 Hz, mono, fltp, 48 kb/s
        Metadata:
          encoder         : Lavc57.22.100 aac
    Stream mapping:
      Stream #0:0 (vp8) -> trim (graph 0)
      setpts (graph 0) -> Stream #0:0 (libx264)
      Stream #0:1 -> #0:1 (pcm_mulaw (native) -> aac (native))
    Press [q] to stop, [?] for help
    [vp8 @ 000002859d9ae460] Discarding interframe without a prior keyframe!
    [vp8 @ 000002859d9aeb00] Discarding interframe without a prior keyframe!
    [vp8 @ 000002859e8eee40] Discarding interframe without a prior keyframe!
    [vp8 @ 000002859e8f5460] Discarding interframe without a prior keyframe!
    Error while decoding stream #0:0: Invalid data found when processing input
        Last message repeated 3 times
    frame=    0 fps=0.0 q=0.0 size=      62kB time=00:00:22.27 bitrate=  22.6kbits/s
    frame=    0 fps=0.0 q=0.0 size=     154kB time=00:00:41.08 bitrate=  30.6kbits/s
    frame=    0 fps=0.0 q=0.0 size=     255kB time=00:01:02.20 bitrate=  33.6kbits/s
    frame=    0 fps=0.0 q=0.0 size=     340kB time=00:01:19.34 bitrate=  35.1kbits/s
    frame=    0 fps=0.0 q=0.0 size=     423kB time=00:01:39.31 bitrate=  34.9kbits/s
    frame=   88 fps= 29 q=29.0 size=     518kB time=00:01:43.79 bitrate=  40.9kbits/
    frame=  140 fps= 40 q=29.0 size=     613kB time=00:01:45.46 bitrate=  47.6kbits/
    frame=  194 fps= 48 q=29.0 size=     719kB time=00:01:47.38 bitrate=  54.8kbits/
    
    ...
    
    
    frame=  839 fps= 14 q=29.0 size=   10881kB time=00:34:51.52 bitrate=  42.6kbits/
    frame=  839 fps= 14 q=29.0 size=   10962kB time=00:35:10.46 bitrate=  42.5kbits/
    frame=  839 fps= 14 q=29.0 size=   11031kB time=00:35:25.44 bitrate=  42.5kbits/
    frame=  839 fps= 14 q=-1.0 Lsize=   11266kB time=00:35:40.16 bitrate=  43.1kbits/s dup=284 drop=328 speed=34.6x
    video:1083kB audio:10104kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.706855%
    [libx264 @ 000002859baf3300] frame I:4     Avg QP:15.24  size: 22651
    [libx264 @ 000002859baf3300] frame P:305   Avg QP:19.95  size:  2626
    [libx264 @ 000002859baf3300] frame B:530   Avg QP:25.41  size:   408
    [libx264 @ 000002859baf3300] consecutive B-frames: 15.7%  0.0%  0.4% 83.9%
    [libx264 @ 000002859baf3300] mb I  I16..4: 15.9% 63.7% 20.4%
    [libx264 @ 000002859baf3300] mb P  I16..4:  0.3%  1.9%  0.3%  P16..4: 22.3%  6.2%  2.4%  0.0%  0.0%    skip:66.5%
    [libx264 @ 000002859baf3300] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8: 16.1%  0.6%  0.1%  direct: 0.2%  skip:82.9%  L0:48.2% L1:48.5% BI: 3.4%
    [libx264 @ 000002859baf3300] 8x8 transform intra:71.1% inter:71.4%
    [libx264 @ 000002859baf3300] coded y,uvDC,uvAC intra: 72.2% 78.3% 40.7% inter: 5.9% 4.0% 0.1%
    [libx264 @ 000002859baf3300] i16 v,h,dc,p: 29% 30% 21% 20%
    [libx264 @ 000002859baf3300] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 18% 14%  5%  6%  9%  6%  9%  6%
    [libx264 @ 000002859baf3300] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 20% 11%  5%  5%  7%  5%  6%  4%
    [libx264 @ 000002859baf3300] i8c dc,h,v,p: 46% 16% 27% 11%
    [libx264 @ 000002859baf3300] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 000002859baf3300] ref P L0: 63.4% 21.5% 11.5%  3.6%
    [libx264 @ 000002859baf3300] ref B L0: 92.6%  6.4%  1.0%
    [libx264 @ 000002859baf3300] ref B L1: 96.4%  3.6%
    [libx264 @ 000002859baf3300] kb/s:316.59
    [aac @ 000002859baf4400] Qavg: 65377.508
    
    D:\Work\ffmpeg\files>