Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • build opencv with ffmpeg support

    20 décembre 2017, par Selin Gök

    I read nearly all of the questions about this subject but I didn't solve it. I am working on Linux/Mint. I installed OpenCV in the virtual environment a lot of times when trying to solve this problem. Problem is that: "cv2.videoCapture() return always false".

    I built the OpenCV with -D WITH_FFMPEG=ON option and it would finish successfully and the result that about FFmpeg was like that: ffmpeg result It seemed to be OK.

    Also, when I run "make -j8" command, it finished with no problem. So I thought everything will be OK. When I tried to check FFmpeg support with this command: python -c "import cv2; print(cv2.getBuildInformation())" | grep -i FFmpeg it gave me NO result.

    I installed OpenCV with following these steps. I also tried to find if FFMPEG supports codec for decoding AVC encoded files. ffmpeg -codecs | grep -i avc and, the output is :

    DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_cuvid ) (encoders: h264_nvenc nvenc nvenc_h264 ) D.A.L. avc On2 Audio for Video Codec (decoders: on2avc )

    I didn't understand why FFmpeg has seemed "YES" when I have building OpenCV at that time has given "NO" result with cv2.getBuildInformation().

    (cv_env)➜  cv_env pkg-config --modversion opencv
    3.2.0
    (cv_env)➜  cv_env python                        
    Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
    [GCC 4.8.4] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import cv2
    >>> cv2.__version__
    '3.3.0'
    
    (cv_env)➜  cv_env python -c "import cv2; print(cv2.getBuildInformation())" | grep -i ffmpeg
        FFMPEG:                      NO
    (cv_env)➜  cv_env python
    Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
    [GCC 4.8.4] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import cv2
    >>> cv2.__file__
    '/opt/cv_env/local/lib/python2.7/site-packages/cv2/cv2.so'
    
    (cv_env)➜  cv_env python3
    Python 3.4.3 (default, Nov 28 2017, 16:41:13) 
    [GCC 4.8.4] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import cv2
    >>> cv2.__version__
    '3.3.0'
    >>> cv2.__file__
    '/usr/local/lib/python3.4/dist-packages/cv2/cv2.cpython-34m.so'
    

    How can I fix it?

  • Trying to send commands via Subprocess to operate with ffmpeg

    20 décembre 2017, par alghul96

    I am trying to build a script that converts video files via ffmpeg inside Python 3. Via Windows PowerShell I successfully obtained the desired result via the following command:

    ffmpeg -i test.webm -c:v libx264 converted.mp4
    

    However, if I try to repeat the same operation inside python via the following code:

    import subprocess
    from os import getcwd
    
    print(getcwd()) # current directory
    subprocess.call(["ffmpeg", " -f test.webm -c libx264 converted.mp4"])
    

    I get the following error:

    Output #0, mp4, to ' -f test.webm -c libx264 converted.mp4':
    Output file #0 does not contain any stream
    

    I am in the correct folder where the files are. Do you have better methods to execute commands in shell via Python? That should preferably work on different platforms.

  • wrong duration when copying audio from ts to mp2 audio

    20 décembre 2017, par Ahmed Fares

    When I copy audio from a .ts video file using ffmpeg with following command, the resulting audio file is shorter than the original file, because of the silent parts of the original file.

    ffmpeg -i InputFile.ts -vn -acodec copy OutputFile

  • Text overlay on ffmpeg live stream rtmp output [duplicate]

    20 décembre 2017, par Ricky

    This question already has an answer here:

    I have ffmpeg take an HLS stream and output into an rtmp url with this command.

    ffmpeg -re -i "http://184.72.239.149/vod/smil:BigBuckBunny.smil/playlist.m3u8" -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 6000k -vb 400k -maxrate 1500k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -f flv "rtmp://ingest-us-east.a.switchboard.zone/live/moo-abced-ppoo-noas"

    I would like to put text overlay on the stream but I can't figure out how to do it. I need to have the the ability to control when the text comes up on the screen. Your help is much appreciated.

  • Pause FFMPEG and resume it with newest frame

    20 décembre 2017, par user38931

    For my software, I use FFMPEG to write frames from a tcp video stream into a bitmap file.

    I need to pause and resume the FFMPEG process, which I accomplish with sending SIGSTOP and SIGCONT to the process.

    However, when FFMPEG is resumed, it seems to continue with the frame it left off. Instead, I would like FFMPEG to write the newest frame seen by the camera into the bitmap file.

    Does somebody know how to achieve that?

    I looked into the documentation of FFMPEG and found the switch -vsync, but do not really understand the effect of "passthrough", "vfr" or "drop". Can someone please explain with an example what these arguments do?