Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • 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.

  • Using FFMPEG and Open CV and encoding webcam stream to h264 in VC 2010

    22 novembre 2013, par Osaid

    I am trying to capture video stream and at the same time willing to encode it to h264 and save it to a file. I am using OpenCV to capture stream but am having problem converting them to h264 via FFMPEG. OS is WINDOWS XP and VC 2010 is the environment.

    I referred the encoding_decoding (refer video encoding section) provided by the FFMPEG. FFMPEG uses AVFrame i.e.

    AVFrame *frame;
    

    structure in which there is image data at frame->data but in OpenCV I am capturing frames in

    Mat WebCamFrame;
    cap >> WebCamFrame;   //Captures frame from webcam and puts it to WebCamFrame
    

    For encoding I have to get this captured WebCamFrame to frame->data then encode it using the

    avcodec_encode_video2(c, &pkt, frame, &got_output);
    

    in the encoding_decoding example a dummy image is created as

    /* prepare a dummy image */
    /* Y */
    for(y=0;yheight;y++) 
    {
        for(x=0;xwidth;x++)
        {
            frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3;
        }
    }
    
    /* Cb and Cr */
    for(y=0;yheight/2;y++)
    {
        for(x=0;xwidth/2;x++) 
        {
            frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2;
            frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5;
        }
    }
    

    I do not want to use this dummy image rather the frame captured from webcam to encode it to h264. One more thing, the data type of WebCamFrame is MAT and that of frame is AVFrame. I would really appreciate a hint to proceed further. In a nutshell I want to process Mat frames (webCam video Stream) of OpenCV in FFMPEG avcodec_encode_video2() and write the video to a file.

  • Retrieving RTP time from an IP camera programatically using FFMPEG

    22 novembre 2013, par Dídac Pérez

    I am using the ffmpeg C/C++ library to get the video stream from an IP camera using methods such as avformat_open_input(), av_read_frame(), etc... I would like to get the RTP time from the camera. pts and dts values give me the relative timestamp to the first frame, but I need the absolute date (i.e. 2013/11/22 12:40:30.123) and time since as I read, at the RTP layer the time is sent by the camera, and I have also configured the camera to use the dime from an NTP server.

    Please, I am really confused and I have tried everything without success, I am not able to find this date and time. Any help will be really appreciated, thank you so much.

  • WebRTC : unsync audio after processing using ffmpeg

    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
    
  • Generate images at given time from flv video using ffmpeg

    22 novembre 2013, par CodeJack

    I am using the following command in ffmpeg to generate thumbnails. It is working perfect.

    ffmpeg -i videofile.flv -an -ss 01:00:00 -an -r 1 -vframes 1 -y ".$outputdir."/".$groupid."_".$i.".jpg
    

    But problem is I have different seek times of a video from where thumbnails have to be generated and right now Iam using a loop which is running very slow. I found the reason as ffmpeg seeks to the given time for every command. I tried forking the process but is not effective. Is there anyways i can optimise the command so the repetitive seeks can be avoided?