Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffmpeg make : *** No rule to make target 'distclean'. Stop

    11 octobre 2016, par Djave

    I'm installing ffmpeg using this guide https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu on a Digital Ocean droplet.

    I've run all the commands down to

    $ make distclean
    

    and after I do this I get the error

    make: *** No rule to make target 'distclean'.  Stop.
    

    How can I get past this step?

  • Encoding a Data Stream Alongside Video in FFMPEG

    11 octobre 2016, par AdmiralJonB

    I'm wanting to encode some proprietary data (it's a serialised unsigned 64-bit integer per frame) into a video container (mp4) as a data stream, but I have been unable to find any instructions/tutorials of anyone doing this.

    The only thing I've been able to find is this, which describes potentially how to create a data stream (the user had no success apparently https://lists.libav.org/pipermail/ffmpeg-user/2006-November/005070.html)

    This is my current code for creating a stream:

        ff_data_stream = avformat_new_stream(ff_output_context, NULL);
    
        ff_data_stream->codec->codec_type = AVMEDIA_TYPE_DATA;
        ff_data_stream->codec->codec_id = AV_CODEC_ID_NONE;
        ff_data_stream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
    

    But then when I'm calling avformat_write_header it errors with the following output to console:

    [mp4 @ 0x7fff68000900] track 1: could not find tag, codec not currently supported in container

    So my questions are as follows:

    • Is it possible to create a data stream with an mp4 container? If not, are there any containers that do?
      • This might not be the right way to do this, but I have not yet come across any method of doing so.
    • If so, how can I configure the stream correctly? (Whether it's for this container or another)
    • Would one then use an AVPacket when writing to file? And write it into the file by using av_interleaved_write_frame?

    Thanks

  • Building and using OpenCV as a static library with Ffmpeg

    11 octobre 2016, par Matt Hammond

    I'm trying write an OpenCV application. I've statically built OpenCV from source as I don't want dll files and my project compiles as long as I don't use cv::VideoCapture, in which case I get a link error LNK2019 unresolved external symbol.

    I think this is because the cv::VideoCapture uses ffmpeg to work with video, which, because of it's license, cannot be statically linked in my project. I would be ok with linking the ffmpeg dynamically but I'm having trouble doing this. There is a opencv_ffmpeg310_64.dll file in the %OpenCV_DIR%\bin folder, but I'm clueless about how to dynamically link it to my project. Usually I have .lib files that come with the .dll but I can't find them anywhere.

    Is it possible to statically link OpenCV and dynamically link ffmpeg, and how should I go about doing this?

    Additional info:

    • Windows 10
    • Visual Studio 2015
    • OpenCV 3.1.0 x64 build
  • How do I run two indefinite loops simultaneously, while also changing variables within them ?

    11 octobre 2016, par Nyalmo

    I'm trying to write a script in Python that records a stream of an IP camera in realtime. It only keeps about a minute worth of recording, constantly overwriting the same files. Whenever an external sensor is triggered I want a variable to be set (event variable) which merges the recording with an extra 30 seconds it records after the sensor is triggered. The combined 90 seconds are then saved as the date and time for later review.

    The idea was to have 2 indefinite while loops, the first containing both the real time recording and the event. The second one would constantly read input and activate the 'event' function. Initially I though I could just have a software version of the hardware interrupt I've learned before, though after some research it seems that's only for exceptions. I'm currently using TkInter, simulating the external input with keypresses.

    When I tried it out the input wouldn't cause the event to be triggered. So my question is: How do I run the two indefinite loops simultaneously, while also having the input loop change variables in the main loop so that the 'event' can actually occur in real-time?

    Since I'm using ffmpeg to record the stream, once the command is called to record it can't be stopped, but I want the event variable to be changed as soon as possible.

    I've looked at several similar questions regarding multiple loops, and have tried multiprocessing(though this only seems to be used for performance, which is not that important here), making two separate files(not sure how to have them work together) and lastly, threads. None of these seem to work in my situation as I can't get them running in the way that I want.

    Here is my latest attempt, using threads:

    i = 0
    event = False
    aboutToQuit = False
    someVar = 'Event Deactivated'
    lastVar = False
    
    def process(frame):
        print "Thread"
        i = 0    
        frame = frame 
        frame.bind("", switch)
        frame.bind("", exit) 
        frame.pack()
        frame.focus_set()
    
    def switch(eventl):
        print(['Activating','Deactivating'][event])
        event = eventl
        event = not(event)
    
    def exit(eventl):
        print'Exiting Application'
        global aboutToQuit
        #aboutToQuit = True
        root.destroy()
    
    print("the imported file is", tkinter.__file__)
    def GetTime(): #function opens a script which saves the final merged file as date and time.
        time = datetime.datetime.now()
        subprocess.call("./GetTime.sh", shell = True)
        return (time)
    
    def main(root):
        global event, aboutToQuit, someVar,lastVar      
        while (not aboutToQuit):
            root.update() # always process new events
    
            if event == False:
                someVar = 'Event Deactivated'
                subprocess.call(Last30S_Command) #records last 30 seconds overwriting itself.
                print "Merge now"
                subprocess.call(Merge_Command) #merges last 30 seconds with the old 30 seconds       
                print "Shift now"
                subprocess.call(Shift_Command) #copies the last30s recording to the old 30 seconds, overwriting it.
                if lastVar == True: #Triggers only when lastVar state changes
                    print someVar
                    lastVar = False
                time.sleep(.1)
    
            if event == True: 
                 someVar = 'Event Activated'
                print"Record Event"
                subprocess.call(EventRecord_Command) #records 30 seconds after event is triggered.
                print"EventMerge Now"
                subprocess.call(EventMerge_Command) # merges the 1 minute recording of Merge_Command with 30 seconds of EventRecord_Command
                if lastVar == False:
                    print someVar
                    lastVar = True
                time.sleep(.1)
                GetTime() #Saves 90 seconds of EventMerge_Command as date and time.
                subprocess.call(EventShift_Command) #Copies EventRecord file to the old 30 second recording, overwriting it
    
            if aboutToQuit:
               break
    
    
    if __name__ == "__main__":
        root = Tk() 
        frame = Frame(root, width=100, height=100)   
    #   maintthread = threading.Thread(target=main(root))
    #   inputthread = threading.Thread(target=process(frame))
    #   inputthread.daemon = True
    #   inputthread.start()
    #   maintthread.daemon = True
    #   maintthread.start()
    #   maintthread.join()
        Process(target=process(frame)).start()
        Process(target=main(root)).start()
        print "MainLoop"
    
  • how to I combine 2 or more f4v files with ffmpeg without loosing quality [on hold]

    11 octobre 2016, par Jeremy M

    I am wondering how I would go about doing this without loosing quality. There is 9 f4v files that I want to combine in a specific order without loosing quality