Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Video Comparison Using Java - Video similarity [on hold]

    23 novembre 2013, par Emily Webb

    Is there approach to compare 2 videos and check are they different versions of the same video...

    Here by different version I meant that we can create two same videos with different resolutions or one of the video can be a large video and the other one can be a portion of it.But we should recognize both videos as same video in this scenario.

    Is there any java libraries to attain this ? Or is there any approaches to achieve this?

  • Shell script - loop through directories ?

    22 novembre 2013, par Darius

    If I wanted to loop through a list of nested directories and run a set commands, how would I do that?

    My directory structure is like this:

    • videos
      • folder1 -> VTS_01_1.mp4
      • folder2 -> VTS_01_1.mp4
      • folder3 -> VTS_01_1.mp4 .... and so on

    I need to loop through each folder and run the script below.. All of the .mp4 files are named VTS_01_1.mp4, but I'd like to do it with a *.mp4 wildcard condition just incase they aren't. The output file in each directory should be "VTS_01_h264.mp4". Ideas? I'm using CentOS 6.4.

    ffmpeg -y -i "VTS_01_1.mp4" -an -pass 1 -threads 2 -vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \
           -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \
           -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \
           -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \
               -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\
           -qmax 51 -qdiff 4 "video_tmp.mp4"
    
    
    
    ffmpeg -y -i "VTS_01_1.mp4" -acodec libfaac -ar 44100 -ab 96k -pass 2 -threads 2 -vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \
           -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \
           -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \
           -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \
               -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\
           -qmax 51 -qdiff 4 "video_tmp.mp4"
    
    
    
    qt-faststart "video_tmp.mp4" "VTS_01_h264.mp4"
    
  • How to load cross domain videos into video tag for web gl processing ?

    22 novembre 2013, par user3022391

    Current working on a project using FFMpeg and stream.m to transcode a live stream to web.m format for use in a HTML5 desktop player on chrome. All works well when sending the video to a standard video tag, however when it used in my canvas / webgl application it struggles to load the video reporting the following error repeatedly:

    Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': the video element contains cross-origin data, and may not be loaded.

    Looking into CORS, it seems that because the website is loading on http (80) and I am streaming the converted video live from the stream.m server (which is on the same domain but uses port 8089 - this counts as cross-domain video sourcing. I've added allow policies to the .htaccess file and cross-domain.xml however still seeing the issue.

    Does anyone know if you can add custom allow-access headers to ffmpeg output or know of an alternative workaround?

  • WebRTC : unsync audio after processing using ffmpeg (audio length is less than that of video)

    22 novembre 2013, par QuickSilver

    I am recording a video and using RecordRTC: WebRTC . After receiving the webm video and wav audio at server, I'm encoding it to a mp4 file using ffmpeg(executing shell command via php). But after encoding process, the audio is unsync with video (audio ends before video). How can I fix this?

    I have noticed that the recorded audio is 1 sec less in length with video.

    js code is here

    record.onclick = function() {
        record.disabled = true;
        var video_constraints = {
            mandatory: {
                "minWidth": "320",
                "minHeight": "240",
                "minFrameRate": "24",
                "maxWidth": "320",
                "maxHeight": "240",
                "maxFrameRate": "24"
            },
            optional: []
        };
        navigator.getUserMedia({
            audio: true,
            video: video_constraints
        }, function(stream) {
            preview.src = window.URL.createObjectURL(stream);
            preview.play();
    
            // var legalBufferValues = [256, 512, 1024, 2048, 4096, 8192, 16384];
            // sample-rates in at least the range 22050 to 96000.
            recordAudio = RecordRTC(stream, {
                /* extra important, we need to set a big buffer when capturing audio and video at the same time*/
                bufferSize: 16384
                //sampleRate: 45000
            });
    
            recordVideo = RecordRTC(stream, {
                type: 'video'
            });
    
            recordVideo.startRecording();
            recordAudio.startRecording();
    
            stop.disabled = false;
            recording_flag = true;
            $("#divcounter").show();
            $("#second-step-title").text('Record your video');
            initCountdown();
            uploadStatus.video = false;
            uploadStatus.audio = false;
        });
    };
    

    ffmpeg command used is :

    ffmpeg -y -i 166890589.wav -i 166890589.webm -vcodec libx264 166890589.mp4
    

    Currently I'm adding an offset of -1 to ffmpeg, but i don't think it's right.

    ffmpeg -y -itsoffset -1 -i 166890589.wav -i 166890589.webm -vcodec libx264 166890589.mp4
    
  • Decoding an elementary HEVC stream using ffmpeg

    22 novembre 2013, par Zax

    I have successfully compiled and installed FFMPEG_2.1 from source code. I know that ffmpeg from version 2.1 onwards supports HEVC decoder. I have generated a .bin file using HM 10.0 and HM 11.0 HEVC reference code.

    However, when i give this bin file as an input to the ffmpeg i get an Input/output Error.

    The command that i have used is given below:

    ffmpeg -i Johnny_1280x720_60qp22.bin out.yuv
    

    The output of the above command is as shown below:

    ffmpeg version 2.1 Copyright (c) 2000-2013 the FFmpeg developers
      built on Nov 21 2013 15:52:14 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
      configuration: 
      libavutil      52. 48.100 / 52. 48.100
      libavcodec     55. 39.100 / 55. 39.100
      libavformat    55. 19.104 / 55. 19.104
      libavdevice    55.  5.100 / 55.  5.100
      libavfilter     3. 90.100 /  3. 90.100
      libswscale      2.  5.101 /  2.  5.101
      libswresample   0. 17.104 /  0. 17.104
    Input #0, bin, from 'Johnny_1280x720_60qp22.bin':
      Duration: N/A, bitrate: N/A
        Stream #0:0: Video: bintext, pal8, 1280x118288, 25 tbr, 25 tbn, 25 tbc
    Output #0, rawvideo, to 'out.yuv':
      Metadata:
        encoder         : Lavf55.19.104
        Stream #0:0: Video: rawvideo, pal8, 1280x118288, q=2-31, 200 kb/s, 90k tbn, 25 tbc
    Stream mapping:
      Stream #0:0 -> #0:0 (bintext -> rawvideo)
    Press [q] to stop, [?] for help
    Johnny_1280x720_60qp22.bin: Input/output error
    frame=    1 fps=0.3 q=0.0 size=  147861kB time=00:00:00.04 bitrate=30281932.8kbiframe=    1 fps=0.3 q=0.0 Lsize=  147861kB time=00:00:00.04 bitrate=30281932.8kbits/s    
    video:147861kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.000000
    

    Can anyone please tell me why i'm facing this problem and how i can rectify it.