Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • What codec/format to use for fastest possible decoding ?

    2 mars 2017, par JT J

    I'm using an ffmpeg script (in Windows) that extracts all the keyframes from a video and pastes them into a folder. I've made sure that my drive speed, CPU, and RAM are not causing a bottleneck.

    The quality of the video is actually not important at all in this case. I need to encode the video that the script extracts frames from so that it has the fastest possible decoding speed. File size and quality are not important, only read speed. The video does not have audio. What would work best for me?

    If it matters, here's the script I'm working with:

    ffmpeg -i input.mp4 -vf "select=eq(pict_type\,I)" -vsync 1 %%3d.bmp
    

    Sorry if sound like I don't know what I'm talking about, this is not a topic I am super familiar with. I appreciate your help!

  • OpenCV : FFMPEG : tag 0xffffffff/'����' is not found (format 'mp4 / MP4 (MPEG-4 Part 14)')'

    2 mars 2017, par Gingerbread

    I am trying to save a background subtracted video in python and the following is my code.

    import cv2
    import numpy as np
    
    capture = cv2.VideoCapture('MAH00119.mp4')
    size = (int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)),
    int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT)))
    fourcc = cv2.VideoWriter_fourcc(*'X264')
    out = cv2.VideoWriter('output.mp4', -1 , 20.0 , size)
    fgbg= cv2.createBackgroundSubtractorMOG2()
    
    while True:
        ret, img = capture.read()
        if ret==True:
            fgmask = fgbg.apply(img)
            out.write(fgmask)
            cv2.imshow('img',fgmask)
    
        if(cv2.waitKey(27)!=-1):
            break
    
    capture.release()
    out.release()
    cv2.destroyAllWindows()
    

    However, this keeps throwing the following error: "OpenCV: FFMPEG: tag 0xffffffff/'����' is not found (format 'mp4 / MP4 (MPEG-4 Part 14)')'"

    I have FFMPEG installed and have added it to the environment variables. My background subtraction code without having to save to a file works fine, so I know there's nothing wrong with openCV installation. I am stuck at this place. I know that my python doesn't seem to recognize FFMPEG but I don't know what else to do apart from adding FFMPEG to the environment variables. I am using OpenCV version 3.2 on Windows 10 and Python 2.7.

    Any help will be much appreciated!

  • Best way to extract all keyframes from a video in Java ?

    2 mars 2017, par JT J

    I have a Windows batch script that I'm currently trying to recreate in Java. The script runs an ffmpeg command that extracts all of the keyframes from a video and pastes them as .BMP images in a folder.

    This is what it the script looks like:

    ffmpeg -i input.mp4 -vf "select=eq(pict_type\,I)" -vsync 1 %%3d.bmp
    

    The end result of this is that it takes "input.mp4" and outputs each keyframe as 001.bmp, 002.bmp... and so on.

    I'm trying to avoid simply starting an ffmpeg runtime, because I want to be able to run this script on other platforms in the future. Also, I'll be doing this for very long videos (multiple hours long sometimes) so performance is very important, and needs to be done as fast as possible. Is it possible to use multithreading? That's something I'm not familiar with in Java. What would be the best way to do this?

  • make live streaming into any device from RED5 server

    2 mars 2017, par user7647539

    I use RED5 server for my live streaming. I use flash player in my wordpress website to watch the movie in my desktop. I've also ffmpeg installed in my server. what can I do to watch this stream in mobile phone. I try many tutorials but nothing I don't where is the problem.

    thanks your help

  • timelapse images into a movie, 500 at a time

    2 mars 2017, par molly78

    I am trying to make a script to turn a bunch of timelapse images into a movie, using ffmpeg.

    The latest problem is how to loop thru the images in, say, batches of 500.

    There could be 100 images from the day, or there could be 5000 images.

    The reason for breaking this apart is due to running out of memory.

    Afterwards I would need to cat them using MP4Box to join all together...

    I am entirely new to bash, but not entirely programming.

    What I think needs to happen is this

    1) read in the folders contents as the images may not be consecutively named

    2) send ffmpeg a list of 500 at a time to process (https://trac.ffmpeg.org/wiki/Concatenate)

    2b) while you're looping thru this, set a counter to determine how many loops you've done

    3) use the number of loops to create the MP4Box cat command line to join them all at the end.

    the basic script that works if there's only say 500 images is:

    #!/bin/bash
    
    dy=$(date '+%Y-%m-%d')
    
    ffmpeg -framerate 24 -s hd1080 -pattern_type glob -i "/mnt/cams/Camera1/$dy/*.jpg" -vcodec libx264 -pix_fmt yuv420p Cam1-"$dy".mp4
    

    MP4Box's cat command looks like:

    MP4Box -cat Cam1-$dy7.mp4 -cat Cam1-$dy6.mp4 -cat Cam1-$dy5.mp4 -cat Cam1-$dy4.mp4 -cat Cam1-$dy3.mp4 -cat Cam1-$dy2.mp4 -cat Cam1-$dy1.mp4 "Cam1 - $dy1 to $dy7.mp4"
    

    Needless to say help is immensely appreciated for my project