Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • If you rotate the iPhone's video with ffmpeg, the rotation information sticks. Can I hide this ?

    24 août 2017, par howmanylife

    The following implementation is a command to rotate the movie by 90 degrees.

    ffmpeg -i video.mp4 -vf transpose=1 -metadata:s:v:0 rotate=0 videoo.mp4
    -vf transpose=1
    

    The iPhone's video contains rotation information and actually

    ffprobe -show_streams -print_format json videoo.mp4 2>/dev/null
    

    To output motion picture information or rotation information as described below.

     "tags": {
                    "rotate": "90",
                    "creation_time": "2017-08-24T01:49:38.000000Z",
                    "language": "und",
                    "handler_name": "Core Media Data Handler",
                    "encoder": "'avc1'"
                },
                "side_data_list": [
                    {
                        "side_data_type": "Display Matrix",
                        "displaymatrix": "\n00000000:            0       65536           0\n00000001:       -65536           0           0\n00000002:            0           0  1073741824\n",
                        "rotation": -90
                    }
                ]
    
    
    
    "rotate": "90",
    

    and

    "side_data_list":
    

    and

    "rotation": -90
    

    Is it possible to hide this? Or is it possible to erase only this rotation information?

  • How to stop ffmpeg after it has finished python

    24 août 2017, par Joey B

    I have a function that finds an mp4 video in a temp folder, converts it to an mp3 in a seperate folder, called music, and then deletes the mp4 from the temp folder. It looks like such:

    import imageio
    imageio.plugins.ffmpeg.download()
    import moviepy.editor as mp
    
    def convert_mp4_to_mp3():
        video_file = os.listdir(os.getcwd() + '//temp')[0]
        audio_file = video_file.replace('mp4','mp3')
        clip = mp.VideoFileClip(os.getcwd() + '//temp//' + video_file)
        clip.audio.write_audiofile(os.getcwd() + '//music//' + audio_file)
        os.system("taskkill /f /im ffmpeg.win32.exe*32")
        os.remove(os.getcwd() + '//temp//' + video_file)
    

    The function successfully completes the conversion of mp4 to mp3 but when I try and delete the file, I get the following error:

    PermissionError: [WinError 32] The process cannot access the file because it 
    is being used by another process
    

    Upon trying to manually delete the file, I discovered it was because "ffmpeg.win32.exe" is still running with the file open. I could not manually delete it until I killed that process.

    I tried implementing the second to last line (os.system("taskkill /f /im ffmpeg.win32.exe*32") to kill the process but I still come up with the same error.

    So my question is, is there a simple way to kill ffmpeg once I know I am done with it or is there a workaround to somehow kill it via another process? I am working in python3.6 on a windows 7 pc. Thanks in advance for the help!

  • frames left in the queue on closing - FFMpeg

    24 août 2017, par Sepehr Norouzi

    Im working with FFmpeg on PHP. First I download audio file with wget on linux.

    Then I start ffmpeg to encode my audio file with new metadata but unfortunately this error displays:

    frames left in the queue on closing 
    

    What's the problem?

  • MediaSource through socket stops

    23 août 2017, par Paulo Galdo Sandoval

    i'm trying to stream a rtsp live stream through socket.io using ffmpeg (this works fine), but now i need to get that video from the socket and play it on a HTML5 video tag.

    To do this i'm using MediaSurce, getting small pieces of video through the socket and then appending it to the MediaSource

    This solution reproduces the video a few seconds o minutes and then suddenly stops and it doesn't throw me any error on the Chrome console

        var socket = io();
    
        var ms = new MediaSource();
        var sourceBuffer;
        var queue = [];
        var video = document.getElementById("video");
        video.src = window.URL.createObjectURL(ms);
    
        socket.on('start', function (response) {
            console.log(response);
            socket.emit('streaming', $stateParams.id);
            ms.addEventListener('sourceopen', videoLoad, false);
            ms.addEventListener('sourceclose', videoClosed, false);
        });
    
    
        function videoLoad() {
            sourceBuffer = ms.addSourceBuffer('video/webm; codecs="vorbis,vp8"');
            sourceBuffer.addEventListener('update', function () {
                if (queue.length > 0 && !sourceBuffer.updating) {
                    console.log(queue.length);
                    sourceBuffer.appendBuffer(queue.shift());
                }
            });
    
            socket.on('data', function (response) {
                var bytes = new Uint8Array(response);
                var blob = new Blob(bytes);
                console.log(blob.size);
                if (sourceBuffer.updating || queue.length > 0) {
                    queue.push(bytes);
                } else {
                    sourceBuffer.appendBuffer(bytes);
                }
            });
        }
    
        function videoClosed(e) {
            console.log('mediaSource readyState: ' + this.readyState);
        }
    

    On my chrome://media-internals/ the video players log show me a couple of time this, and then the video stops

    video_buffering_state   BUFFERING_HAVE_ENOUGH
    
  • How i can scale a Video using JAVA CV

    23 août 2017, par Aqeel Haider

    I want to scale a video using Java CV. This is the ffmpeg command for scaling a video.

    ffmpeg -i  -s x 
    

    The JavaCV has ffmpegFrameGrabber.java, ffmpegFrameRecorder.java and ffmpegFrameFilter.java, but i don't know how to achieve this command using JavaCV.

    I don't want Java Cli Wrapper, I only want to use JavaCV as the app I'm working on use different OS.

    If you know different approach kindly share with me.