Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • RTMP to HLS : Segmentation fault

    25 mai 2013, par Wildan Muhlis

    I have tried convert RTMP to HLS with ffmpeg. The segments created without -segment_format mpegts parameter, but it resulting corrupted .m3u8 file, If I add the parameter, segments couldn't created due to below error message.

    Anyone know how to solve it?

    ffmpeg encoding profile:

    ffmpeg -y -i ${input}" live=1 swfVfy=1" \
    -ar 48000 \
    -ab 64k \
    -s ${WIDTH}x${HEIGHT} \
    -vcodec libx264 \
    -b:v ${BR} \
    -partitions +parti4x4+partp8x8+partb8x8 \
    -subq 7 \
    -trellis 0 \
    -refs 0 \
    -coder 0 \
    -me_range 16 \
    -keyint_min 25 \
    -sc_threshold 40 \
    -i_qfactor 0.71 \
    -bt 200k \
    -maxrate ${BR} \
    -bufsize ${BR} \
    -rc_eq 'blurCplx^(1-qComp)' \
    -qcomp 0.6 \
    -qmin 30 \
    -qmax 51 \
    -qdiff 4 \
    -level 30 \
    -aspect ${WIDTH}:${HEIGHT} \
    -g 30 \
    -async 2 \
    -flags -global_header -map 0 \
    -f segment \
    -flags +loop \
    -segment_time 10 \
    -segment_list ${SEGMENT_LIST} \
    -segment_format mpegts\
    -segment_list_flags +live \
    ${OUTPUT}
    

    Error log:

    ffmpeg version N-53211-g5918b7a Copyright (c) 2000-2013 the FFmpeg developers
      built on May 18 2013 09:16:55 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
      configuration: --as=yasm --enable-gpl --enable-pthreads --disable-ffserver --disable-shared --enable-static --enable-gpl --enable-libfdk_aac --enable-libmp3lame --enable-libtheora --enable-libvpx --enable-libx264 --enable-librtmp --enable-nonfree
      libavutil      52. 33.100 / 52. 33.100
      libavcodec     55. 10.100 / 55. 10.100
      libavformat    55.  7.100 / 55.  7.100
      libavdevice    55.  0.100 / 55.  0.100
      libavfilter     3. 68.101 /  3. 68.101
      libswscale      2.  3.100 /  2.  3.100
      libswresample   0. 17.102 /  0. 17.102
      libpostproc    52.  3.100 / 52.  3.100
    rtmp server sent error
    Metadata:
      audiocodecid          .mp3
      videokeyframe_frequency5.00
      avclevel              30.00
      videodevice           ASUS USB2.0 Webcam
      audiosamplerate       44100.00
      audiochannels         2.00
      width                 320.00
      videodatarate         200.00
      presetname            Custom
      audioinputvolume      75.00
      creationdate          Sat May 25 20:02:26 2013
      videocodecid          avc1
      audiodevice           Microphone (Realtek High Defini
      avcprofile            66.00
      audiodatarate         96.00
      height                240.00
      framerate             30.00
    [flv @ 0x2df2960] max_analyze_duration 5000000 reached at 5018000 microseconds
    [flv @ 0x2df2960] decoding for stream 0 failed
    Input #0, flv, from 'rtmp://122.22.117.60:1935/oflaDemo/livestream live=1 swfVfy=1':
      Metadata:
        videokeyframe_frequency: 5
        avclevel        : 30
        videodevice     : ASUS USB2.0 Webcam
        keywords        : 
        audiochannels   : 2
        presetname      : Custom
        copyright       : 
        audioinputvolume: 75
        creationdate    : Sat May 25 20:02:26 2013
                        : 
        author          : 
        audiodevice     : Microphone (Realtek High Defini
        avcprofile      : 66
        title           : 
        description     : 
        rating          : 
      Duration: N/A, start: 0.000000, bitrate: 303 kb/s
        Stream #0:0: Video: h264 (Baseline), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 204 kb/s, 30 tbr, 1k tbn, 60 tbc
        Stream #0:1: Audio: mp3, 44100 Hz, stereo, s16p, 98 kb/s
    Segmentation fault
    
  • How to fill audio AVFrame (ffmpeg) with the data obtained from CMSampleBufferRef (AVFoundation) ?

    24 mai 2013, par Aleksei2414904

    I am writing program for streaming live audio and video from webcamera to rtmp-server. I work in MacOS X 10.8, so I use AVFoundation framework for obtaining audio and video frames from input devices. This frames come into delegate:

    -(void) captureOutput:(AVCaptureOutput*)captureOutput didOutputSampleBuffer: (CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection*)connection ,

    where sampleBuffer contains audio or video data.

    When I recieve audio data in the sampleBuffer, I'm trying to convert this data into AVFrame and encode AVFramewith libavcodec:

        aframe = avcodec_alloc_frame();  //AVFrame *aframe;
        int got_packet, ret;
        CMItemCount numSamples = CMSampleBufferGetNumSamples(sampleBuffer); //CMSampleBufferRef
    
        NSUInteger channelIndex = 0;
    
        CMBlockBufferRef audioBlockBuffer = CMSampleBufferGetDataBuffer(sampleBuffer);
    
        size_t audioBlockBufferOffset = (channelIndex * numSamples * sizeof(SInt16));
    
        size_t lengthAtOffset = 0;
    
        size_t totalLength = 0;
    
        SInt16 *samples = NULL;
    
        CMBlockBufferGetDataPointer(audioBlockBuffer, audioBlockBufferOffset, &lengthAtOffset, &totalLength, (char **)(&samples));
    
                const AudioStreamBasicDescription *audioDescription = CMAudioFormatDescriptionGetStreamBasicDescription(CMSampleBufferGetFormatDescription(sampleBuffer));
    
        aframe->nb_samples =(int) numSamples;
    
        aframe->channels=audioDescription->mChannelsPerFrame;
    
        aframe->sample_rate=(int)audioDescription->mSampleRate;
    
         //my webCamera configured to produce 16bit 16kHz LPCM mono, so sample format hardcoded here, and seems to be correct
        avcodec_fill_audio_frame(aframe, aframe->channels, AV_SAMPLE_FMT_S16,
    
                                 (uint8_t *)samples,
    
                                  aframe->nb_samples *
    
                                 av_get_bytes_per_sample(AV_SAMPLE_FMT_S16) *
    
                                 aframe->channels, 0);  
        //encoding audio
        ret = avcodec_encode_audio2(c, &pkt, aframe, &got_packet);
        if (ret < 0) {
            fprintf(stderr, "Error encoding audio frame: %s\n", av_err2str(ret));
            exit(1);
        }
    

    The problem is that when I get so formed frames, I can hear the wanted sound, but it is slowing down and discontinuous (as if after each data frame comes the same frame of silence). It seems that something is wrong in the transformation from CMSampleBuffer to AVFrame , because the preview from the microphone created with AVFoundation from the same sample buffers played normally.

    I would be grateful for your help.

    UPD: Creating and initializing the AVCodceContext structure

        audio_codec= avcodec_find_encoder(AV_CODEC_ID_AAC);
        if (!(audio_codec)) {
            fprintf(stderr, "Could not find encoder for '%s'\n",
                    avcodec_get_name(AV_CODEC_ID_AAC));
            exit(1);
        }
        audio_st = avformat_new_stream(oc, audio_codec);  //AVFormatContext *oc;
        if (!audio_st) {
            fprintf(stderr, "Could not allocate stream\n");
            exit(1);
        }
    
          audio_st->id=1;
          audio_st->codec->sample_fmt= AV_SAMPLE_FMT_S16;
          audio_st->codec->bit_rate = 64000;
          audio_st->codec->sample_rate= 16000;
          audio_st->codec->channels=1;
          audio_st->codec->codec_type= AVMEDIA_TYPE_AUDIO;
    

  • How to Play Video using FFMpeg with Qt5 ?

    24 mai 2013, par user2311434

    I have downloaded the ffmpeg libraries, include and dll from ffmpeg website for windows 32 bit system.

    Until now i have gathered information that the below two headers are useful for playing videos, but actually I dont know.

    libavcodec/avcodec.h libavformat/avformat.h

  • ffmpeg video stitching error (error while opening decoder...)

    24 mai 2013, par Revoluzifer

    I'm trying to stitch nine videos into one grid using this command:

    /usr/local/bin/ffmpeg -loglevel debug 
    -i ./woohoo/7_video.mp4 -i ./woohoo/5_video.mp4 -i ./woohoo/6_video.mp4 
    -i ./woohoo/2_video.mp4 -i ./woohoo/8_video.mp4 -i ./woohoo/0_video.mp4 
    -i ./woohoo/3_video.mp4 -i ./woohoo/1_video.mp4 -i ./woohoo/10_video.mp4 
    -filter_complex "
        [0:0]pad=iw:ih[a];[1:0]scale=w=iw/4:h=ih/4[b];[2:0]scale=w=iw/4:h=ih/4[c];
        [3:0]scale=w=iw/4:h=ih/4[d];[4:0]scale=w=iw/4:h=ih/4[e];
        [5:0]scale=w=iw/4:h=ih/4[f];[6:0]scale=w=iw/4:h=ih/4[g];
        [7:0]scale=w=iw/4:h=ih/4[h];[8:0]scale=w=iw/4:h=ih/4[i];
        [0:0]scale=w=iw/4:h=ih/4[j];
        [a][b]overlay=0*w:0*h[k];[k][c]overlay=1*w:0*h[l];[l][d]overlay=2*w:0*h[m];
        [m][e]overlay=0*w:1*h[n];[n][f]overlay=1*w:1*h[o];[o][g]overlay=2*w:1*h[p];
        [p][h]overlay=0*w:2*h[q];[q][i]overlay=1*w:2*h[r];[r][j]overlay=2*w:2*h
        " 
    -c:v libx264 -an -r 30 -q:v 0 -threads 0 ./woohoo/10_video_out.mp4
    

    I'm running Ubuntu 10.04 LTS

    The complete output given by ffmpeg looks like this:

    ffmpeg version N-52943-g500220a Copyright (c) 2000-2013 the FFmpeg developers
      built on May 23 2013 16:44:21 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
      configuration: --enable-gpl --enable-version3 --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib
      libavutil      52. 30.100 / 52. 30.100
      libavcodec     55.  7.100 / 55.  7.100
      libavformat    55.  4.101 / 55.  4.101
      libavdevice    55.  0.100 / 55.  0.100
      libavfilter     3. 63.101 /  3. 63.101
      libswscale      2.  3.100 /  2.  3.100
      libswresample   0. 17.102 /  0. 17.102
      libpostproc    52.  3.100 / 52.  3.100
    Splitting the commandline.
    
    (...)
    
    Successfully parsed a group of options.
    Parsing a group of options: input file ./woohoo/7_video.mp4.
    Successfully parsed a group of options.
    Opening an input file: ./woohoo/7_video.mp4.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2919e20] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2919e20] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2919e20] File position before avformat_find_stream_info() is 969848
    [h264 @ 0x291aa80] no picture 
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2919e20] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2919e20] File position after avformat_find_stream_info() is 19245
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './woohoo/7_video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf55.4.101
      Duration: 00:00:14.93, start: 0.000000, bitrate: 519 kb/s
        Stream #0:0(und), 1, 1/15360: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 1/60, 516 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
        Metadata:
          handler_name    : VideoHandler
    Successfully opened the file.
    Parsing a group of options: input file ./woohoo/5_video.mp4.
    Successfully parsed a group of options.
    Opening an input file: ./woohoo/5_video.mp4.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x291f580] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x291f580] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x291f580] File position before avformat_find_stream_info() is 990829
    [h264 @ 0x2920340] no picture 
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x291f580] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x291f580] File position after avformat_find_stream_info() is 15914
    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from './woohoo/5_video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf55.4.101
      Duration: 00:00:14.93, start: 0.000000, bitrate: 530 kb/s
        Stream #1:0(und), 1, 1/15360: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 1/60, 528 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
        Metadata:
          handler_name    : VideoHandler
    Successfully opened the file.
    Parsing a group of options: input file ./woohoo/6_video.mp4.
    Successfully parsed a group of options.
    Opening an input file: ./woohoo/6_video.mp4.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2921aa0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2921aa0] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2921aa0] File position before avformat_find_stream_info() is 709220
    [h264 @ 0x2935f60] no picture 
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2921aa0] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2921aa0] File position after avformat_find_stream_info() is 22467
    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from './woohoo/6_video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf55.4.101
      Duration: 00:00:15.00, start: 0.000000, bitrate: 378 kb/s
        Stream #2:0(und), 1, 1/15360: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 1/60, 375 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
        Metadata:
          handler_name    : VideoHandler
    Successfully opened the file.
    Parsing a group of options: input file ./woohoo/2_video.mp4.
    Successfully parsed a group of options.
    Opening an input file: ./woohoo/2_video.mp4.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x29ad800] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x29ad800] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x29ad800] File position before avformat_find_stream_info() is 928241
    [h264 @ 0x29b1040] no picture 
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x29ad800] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x29ad800] File position after avformat_find_stream_info() is 28508
    Input #3, mov,mp4,m4a,3gp,3g2,mj2, from './woohoo/2_video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf55.4.101
      Duration: 00:00:14.87, start: 0.000000, bitrate: 499 kb/s
        Stream #3:0(und), 1, 1/15360: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 1/60, 496 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
        Metadata:
          handler_name    : VideoHandler
    Successfully opened the file.
    Parsing a group of options: input file ./woohoo/8_video.mp4.
    Successfully parsed a group of options.
    Opening an input file: ./woohoo/8_video.mp4.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x29b2f00] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x29b2f00] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x29b2f00] File position before avformat_find_stream_info() is 1038553
    [h264 @ 0x29b3cc0] no picture 
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x29b2f00] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x29b2f00] File position after avformat_find_stream_info() is 20282
    Input #4, mov,mp4,m4a,3gp,3g2,mj2, from './woohoo/8_video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf55.4.101
      Duration: 00:00:15.03, start: 0.000000, bitrate: 552 kb/s
        Stream #4:0(und), 1, 1/15360: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 1/60, 549 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
        Metadata:
          handler_name    : VideoHandler
    Successfully opened the file.
    Parsing a group of options: input file ./woohoo/0_video.mp4.
    Successfully parsed a group of options.
    Opening an input file: ./woohoo/0_video.mp4.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2a30f20] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2a30f20] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2a30f20] File position before avformat_find_stream_info() is 1158061
    [h264 @ 0x2a318e0] no picture 
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2a30f20] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2a30f20] File position after avformat_find_stream_info() is 19639
    Input #5, mov,mp4,m4a,3gp,3g2,mj2, from './woohoo/0_video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf55.4.101
      Duration: 00:00:15.03, start: 0.000000, bitrate: 616 kb/s
        Stream #5:0(und), 1, 1/15360: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 1/60, 614 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
        Metadata:
          handler_name    : VideoHandler
    Successfully opened the file.
    Parsing a group of options: input file ./woohoo/3_video.mp4.
    Successfully parsed a group of options.
    Opening an input file: ./woohoo/3_video.mp4.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ac6ba0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ac6ba0] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ac6ba0] File position before avformat_find_stream_info() is 1102892
    [h264 @ 0x2ab4f00] no picture 
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ac6ba0] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ac6ba0] File position after avformat_find_stream_info() is 22585
    Input #6, mov,mp4,m4a,3gp,3g2,mj2, from './woohoo/3_video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf55.4.101
      Duration: 00:00:15.03, start: 0.000000, bitrate: 586 kb/s
        Stream #6:0(und), 1, 1/15360: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 1/60, 583 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
        Metadata:
          handler_name    : VideoHandler
    Successfully opened the file.
    Parsing a group of options: input file ./woohoo/1_video.mp4.
    Successfully parsed a group of options.
    Opening an input file: ./woohoo/1_video.mp4.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ab6b20] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ab6b20] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ab6b20] File position before avformat_find_stream_info() is 933389
    [h264 @ 0x2ad7d80] no picture 
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ab6b20] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ab6b20] File position after avformat_find_stream_info() is 20610
    Input #7, mov,mp4,m4a,3gp,3g2,mj2, from './woohoo/1_video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf55.4.101
      Duration: 00:00:14.97, start: 0.000000, bitrate: 498 kb/s
        Stream #7:0(und), 1, 1/15360: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 1/60, 495 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
        Metadata:
          handler_name    : VideoHandler
    Successfully opened the file.
    Parsing a group of options: input file ./woohoo/10_video.mp4.
    Successfully parsed a group of options.
    Opening an input file: ./woohoo/10_video.mp4.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ad9ac0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ad9ac0] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ad9ac0] File position before avformat_find_stream_info() is 933355
    [h264 @ 0x2ada4a0] no picture 
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ad9ac0] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x2ad9ac0] File position after avformat_find_stream_info() is 21283
    Input #8, mov,mp4,m4a,3gp,3g2,mj2, from './woohoo/10_video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf55.4.101
      Duration: 00:00:15.03, start: 0.000000, bitrate: 496 kb/s
        Stream #8:0(und), 1, 1/15360: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 1/60, 493 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
        Metadata:
          handler_name    : VideoHandler
    Successfully opened the file.
    Parsing a group of options: output file ./woohoo/10_video_out.mp4.
    Applying option c:v (codec name) with argument libx264.
    Applying option an (disable audio) with argument 1.
    Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 30.
    Applying option q:v (use fixed quality scale (VBR)) with argument 0.
    Successfully parsed a group of options.
    Opening an output file: ./woohoo/10_video_out.mp4.
    [Parsed_pad_0 @ 0x2cb42a0] Setting 'width' to value 'iw'
    [Parsed_pad_0 @ 0x2cb42a0] Setting 'height' to value 'ih'
    [Parsed_scale_1 @ 0x2cb58a0] Setting 'w' to value 'iw/4'
    [Parsed_scale_1 @ 0x2cb58a0] Setting 'h' to value 'ih/4'
    [Parsed_scale_1 @ 0x2cb58a0] w:iw/4 h:ih/4 flags:'bilinear' interl:0
    [Parsed_scale_2 @ 0x2cb6a60] Setting 'w' to value 'iw/4'
    [Parsed_scale_2 @ 0x2cb6a60] Setting 'h' to value 'ih/4'
    [Parsed_scale_2 @ 0x2cb6a60] w:iw/4 h:ih/4 flags:'bilinear' interl:0
    [Parsed_scale_3 @ 0x2cb7920] Setting 'w' to value 'iw/4'
    [Parsed_scale_3 @ 0x2cb7920] Setting 'h' to value 'ih/4'
    [Parsed_scale_3 @ 0x2cb7920] w:iw/4 h:ih/4 flags:'bilinear' interl:0
    [Parsed_scale_4 @ 0x2cb8580] Setting 'w' to value 'iw/4'
    [Parsed_scale_4 @ 0x2cb8580] Setting 'h' to value 'ih/4'
    [Parsed_scale_4 @ 0x2cb8580] w:iw/4 h:ih/4 flags:'bilinear' interl:0
    [Parsed_scale_5 @ 0x2d2f0c0] Setting 'w' to value 'iw/4'
    [Parsed_scale_5 @ 0x2d2f0c0] Setting 'h' to value 'ih/4'
    [Parsed_scale_5 @ 0x2d2f0c0] w:iw/4 h:ih/4 flags:'bilinear' interl:0
    [Parsed_scale_6 @ 0x2d302a0] Setting 'w' to value 'iw/4'
    [Parsed_scale_6 @ 0x2d302a0] Setting 'h' to value 'ih/4'
    [Parsed_scale_6 @ 0x2d302a0] w:iw/4 h:ih/4 flags:'bilinear' interl:0
    [Parsed_scale_7 @ 0x2d31060] Setting 'w' to value 'iw/4'
    [Parsed_scale_7 @ 0x2d31060] Setting 'h' to value 'ih/4'
    [Parsed_scale_7 @ 0x2d31060] w:iw/4 h:ih/4 flags:'bilinear' interl:0
    [Parsed_scale_8 @ 0x2d31d60] Setting 'w' to value 'iw/4'
    [Parsed_scale_8 @ 0x2d31d60] Setting 'h' to value 'ih/4'
    [Parsed_scale_8 @ 0x2d31d60] w:iw/4 h:ih/4 flags:'bilinear' interl:0
    [Parsed_scale_9 @ 0x2d32c60] Setting 'w' to value 'iw/4'
    [Parsed_scale_9 @ 0x2d32c60] Setting 'h' to value 'ih/4'
    [Parsed_scale_9 @ 0x2d32c60] w:iw/4 h:ih/4 flags:'bilinear' interl:0
    [Parsed_overlay_10 @ 0x2cb69a0] Setting 'x' to value '0*w'
    [Parsed_overlay_10 @ 0x2cb69a0] Setting 'y' to value '0*h'
    [Parsed_overlay_11 @ 0x2cb6420] Setting 'x' to value '1*w'
    [Parsed_overlay_11 @ 0x2cb6420] Setting 'y' to value '0*h'
    [Parsed_overlay_12 @ 0x2d2ee20] Setting 'x' to value '2*w'
    [Parsed_overlay_12 @ 0x2d2ee20] Setting 'y' to value '0*h'
    [Parsed_overlay_13 @ 0x2cb7220] Setting 'x' to value '0*w'
    [Parsed_overlay_13 @ 0x2cb7220] Setting 'y' to value '1*h'
    [Parsed_overlay_14 @ 0x2d322e0] Setting 'x' to value '1*w'
    [Parsed_overlay_14 @ 0x2d322e0] Setting 'y' to value '1*h'
    [Parsed_overlay_15 @ 0x2d2fba0] Setting 'x' to value '2*w'
    [Parsed_overlay_15 @ 0x2d2fba0] Setting 'y' to value '1*h'
    [Parsed_overlay_16 @ 0x2cb83a0] Setting 'x' to value '0*w'
    [Parsed_overlay_16 @ 0x2cb83a0] Setting 'y' to value '2*h'
    [Parsed_overlay_17 @ 0x2cb8480] Setting 'x' to value '1*w'
    [Parsed_overlay_17 @ 0x2cb8480] Setting 'y' to value '2*h'
    [Parsed_overlay_18 @ 0x2d30d80] Setting 'x' to value '2*w'
    [Parsed_overlay_18 @ 0x2d30d80] Setting 'y' to value '2*h'
    [graph 0 input from stream 0:0 @ 0x2d36880] Setting 'video_size' to value '640x360'
    [graph 0 input from stream 0:0 @ 0x2d36880] Setting 'pix_fmt' to value '0'
    [graph 0 input from stream 0:0 @ 0x2d36880] Setting 'time_base' to value '1/15360'
    [graph 0 input from stream 0:0 @ 0x2d36880] Setting 'pixel_aspect' to value '1/1'
    [graph 0 input from stream 0:0 @ 0x2d36880] Setting 'sws_param' to value 'flags=2'
    [graph 0 input from stream 0:0 @ 0x2d36880] Setting 'frame_rate' to value '30/1'
    [graph 0 input from stream 0:0 @ 0x2d36880] w:640 h:360 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
    [graph 0 input from stream 1:0 @ 0x2d2e780] Setting 'video_size' to value '640x360'
    [graph 0 input from stream 1:0 @ 0x2d2e780] Setting 'pix_fmt' to value '0'
    [graph 0 input from stream 1:0 @ 0x2d2e780] Setting 'time_base' to value '1/15360'
    [graph 0 input from stream 1:0 @ 0x2d2e780] Setting 'pixel_aspect' to value '1/1'
    [graph 0 input from stream 1:0 @ 0x2d2e780] Setting 'sws_param' to value 'flags=2'
    [graph 0 input from stream 1:0 @ 0x2d2e780] Setting 'frame_rate' to value '30/1'
    [graph 0 input from stream 1:0 @ 0x2d2e780] w:640 h:360 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
    [graph 0 input from stream 2:0 @ 0x2cb4d40] Setting 'video_size' to value '640x360'
    [graph 0 input from stream 2:0 @ 0x2cb4d40] Setting 'pix_fmt' to value '0'
    [graph 0 input from stream 2:0 @ 0x2cb4d40] Setting 'time_base' to value '1/15360'
    [graph 0 input from stream 2:0 @ 0x2cb4d40] Setting 'pixel_aspect' to value '1/1'
    [graph 0 input from stream 2:0 @ 0x2cb4d40] Setting 'sws_param' to value 'flags=2'
    [graph 0 input from stream 2:0 @ 0x2cb4d40] Setting 'frame_rate' to value '30/1'
    [graph 0 input from stream 2:0 @ 0x2cb4d40] w:640 h:360 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
    [graph 0 input from stream 3:0 @ 0x2d318e0] Setting 'video_size' to value '640x360'
    [graph 0 input from stream 3:0 @ 0x2d318e0] Setting 'pix_fmt' to value '0'
    [graph 0 input from stream 3:0 @ 0x2d318e0] Setting 'time_base' to value '1/15360'
    [graph 0 input from stream 3:0 @ 0x2d318e0] Setting 'pixel_aspect' to value '1/1'
    [graph 0 input from stream 3:0 @ 0x2d318e0] Setting 'sws_param' to value 'flags=2'
    [graph 0 input from stream 3:0 @ 0x2d318e0] Setting 'frame_rate' to value '30/1'
    [graph 0 input from stream 3:0 @ 0x2d318e0] w:640 h:360 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
    [graph 0 input from stream 4:0 @ 0x2cb60c0] Setting 'video_size' to value '640x360'
    [graph 0 input from stream 4:0 @ 0x2cb60c0] Setting 'pix_fmt' to value '0'
    [graph 0 input from stream 4:0 @ 0x2cb60c0] Setting 'time_base' to value '1/15360'
    [graph 0 input from stream 4:0 @ 0x2cb60c0] Setting 'pixel_aspect' to value '1/1'
    [graph 0 input from stream 4:0 @ 0x2cb60c0] Setting 'sws_param' to value 'flags=2'
    [graph 0 input from stream 4:0 @ 0x2cb60c0] Setting 'frame_rate' to value '30/1'
    [graph 0 input from stream 4:0 @ 0x2cb60c0] w:640 h:360 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
    [graph 0 input from stream 5:0 @ 0x2d2f9e0] Setting 'video_size' to value '640x360'
    [graph 0 input from stream 5:0 @ 0x2d2f9e0] Setting 'pix_fmt' to value '0'
    [graph 0 input from stream 5:0 @ 0x2d2f9e0] Setting 'time_base' to value '1/15360'
    [graph 0 input from stream 5:0 @ 0x2d2f9e0] Setting 'pixel_aspect' to value '1/1'
    [graph 0 input from stream 5:0 @ 0x2d2f9e0] Setting 'sws_param' to value 'flags=2'
    [graph 0 input from stream 5:0 @ 0x2d2f9e0] Setting 'frame_rate' to value '30/1'
    [graph 0 input from stream 5:0 @ 0x2d2f9e0] w:640 h:360 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
    [graph 0 input from stream 6:0 @ 0x2d33380] Setting 'video_size' to value '640x360'
    [graph 0 input from stream 6:0 @ 0x2d33380] Setting 'pix_fmt' to value '0'
    [graph 0 input from stream 6:0 @ 0x2d33380] Setting 'time_base' to value '1/15360'
    [graph 0 input from stream 6:0 @ 0x2d33380] Setting 'pixel_aspect' to value '1/1'
    [graph 0 input from stream 6:0 @ 0x2d33380] Setting 'sws_param' to value 'flags=2'
    [graph 0 input from stream 6:0 @ 0x2d33380] Setting 'frame_rate' to value '30/1'
    [graph 0 input from stream 6:0 @ 0x2d33380] w:640 h:360 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
    [graph 0 input from stream 7:0 @ 0x2cb55c0] Setting 'video_size' to value '640x360'
    [graph 0 input from stream 7:0 @ 0x2cb55c0] Setting 'pix_fmt' to value '0'
    [graph 0 input from stream 7:0 @ 0x2cb55c0] Setting 'time_base' to value '1/15360'
    [graph 0 input from stream 7:0 @ 0x2cb55c0] Setting 'pixel_aspect' to value '1/1'
    [graph 0 input from stream 7:0 @ 0x2cb55c0] Setting 'sws_param' to value 'flags=2'
    [graph 0 input from stream 7:0 @ 0x2cb55c0] Setting 'frame_rate' to value '30/1'
    [graph 0 input from stream 7:0 @ 0x2cb55c0] w:640 h:360 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
    [graph 0 input from stream 8:0 @ 0x2d34ae0] Setting 'video_size' to value '640x360'
    [graph 0 input from stream 8:0 @ 0x2d34ae0] Setting 'pix_fmt' to value '0'
    [graph 0 input from stream 8:0 @ 0x2d34ae0] Setting 'time_base' to value '1/15360'
    [graph 0 input from stream 8:0 @ 0x2d34ae0] Setting 'pixel_aspect' to value '1/1'
    [graph 0 input from stream 8:0 @ 0x2d34ae0] Setting 'sws_param' to value 'flags=2'
    [graph 0 input from stream 8:0 @ 0x2d34ae0] Setting 'frame_rate' to value '30/1'
    [graph 0 input from stream 8:0 @ 0x2d34ae0] w:640 h:360 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
    [graph 0 input from stream 0:0 @ 0x2d2f8e0] Setting 'video_size' to value '640x360'
    [graph 0 input from stream 0:0 @ 0x2d2f8e0] Setting 'pix_fmt' to value '0'
    [graph 0 input from stream 0:0 @ 0x2d2f8e0] Setting 'time_base' to value '1/15360'
    [graph 0 input from stream 0:0 @ 0x2d2f8e0] Setting 'pixel_aspect' to value '1/1'
    [graph 0 input from stream 0:0 @ 0x2d2f8e0] Setting 'sws_param' to value 'flags=2'
    [graph 0 input from stream 0:0 @ 0x2d2f8e0] Setting 'frame_rate' to value '30/1'
    [graph 0 input from stream 0:0 @ 0x2d2f8e0] w:640 h:360 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
    [format @ 0x2d382c0] compat: called with args=[yuv420p|yuvj420p|yuv422p|yuv444p]
    [format @ 0x2d382c0] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuv444p'
    Successfully opened the file.
    [AVFilterGraph @ 0x2cb0e80] query_formats: 31 queried, 30 merged, 0 already done, 0 delayed
    [Parsed_pad_0 @ 0x2cb42a0] w:640 h:360 -> w:640 h:360 x:0 y:0 color:0x000000FF
    [Parsed_scale_1 @ 0x2cb58a0] w:640 h:360 fmt:yuv420p sar:1/1 -> w:160 h:90 fmt:yuva420p sar:1/1 flags:0x2
    [Parsed_overlay_10 @ 0x2cb69a0] main w:640 h:360 fmt:yuv420p overlay w:160 h:90 fmt:yuva420p
    [Parsed_scale_2 @ 0x2cb6a60] w:640 h:360 fmt:yuv420p sar:1/1 -> w:160 h:90 fmt:yuva420p sar:1/1 flags:0x2
    [Parsed_overlay_11 @ 0x2cb6420] main w:640 h:360 fmt:yuv420p overlay w:160 h:90 fmt:yuva420p
    [Parsed_scale_3 @ 0x2cb7920] w:640 h:360 fmt:yuv420p sar:1/1 -> w:160 h:90 fmt:yuva420p sar:1/1 flags:0x2
    [Parsed_overlay_12 @ 0x2d2ee20] main w:640 h:360 fmt:yuv420p overlay w:160 h:90 fmt:yuva420p
    [Parsed_scale_4 @ 0x2cb8580] w:640 h:360 fmt:yuv420p sar:1/1 -> w:160 h:90 fmt:yuva420p sar:1/1 flags:0x2
    [Parsed_overlay_13 @ 0x2cb7220] main w:640 h:360 fmt:yuv420p overlay w:160 h:90 fmt:yuva420p
    [Parsed_scale_5 @ 0x2d2f0c0] w:640 h:360 fmt:yuv420p sar:1/1 -> w:160 h:90 fmt:yuva420p sar:1/1 flags:0x2
    [Parsed_overlay_14 @ 0x2d322e0] main w:640 h:360 fmt:yuv420p overlay w:160 h:90 fmt:yuva420p
    [Parsed_scale_6 @ 0x2d302a0] w:640 h:360 fmt:yuv420p sar:1/1 -> w:160 h:90 fmt:yuva420p sar:1/1 flags:0x2
    [Parsed_overlay_15 @ 0x2d2fba0] main w:640 h:360 fmt:yuv420p overlay w:160 h:90 fmt:yuva420p
    [Parsed_scale_7 @ 0x2d31060] w:640 h:360 fmt:yuv420p sar:1/1 -> w:160 h:90 fmt:yuva420p sar:1/1 flags:0x2
    [Parsed_overlay_16 @ 0x2cb83a0] main w:640 h:360 fmt:yuv420p overlay w:160 h:90 fmt:yuva420p
    [Parsed_scale_8 @ 0x2d31d60] w:640 h:360 fmt:yuv420p sar:1/1 -> w:160 h:90 fmt:yuva420p sar:1/1 flags:0x2
    [Parsed_overlay_17 @ 0x2cb8480] main w:640 h:360 fmt:yuv420p overlay w:160 h:90 fmt:yuva420p
    [Parsed_scale_9 @ 0x2d32c60] w:640 h:360 fmt:yuv420p sar:1/1 -> w:160 h:90 fmt:yuva420p sar:1/1 flags:0x2
    [Parsed_overlay_18 @ 0x2d30d80] main w:640 h:360 fmt:yuv420p overlay w:160 h:90 fmt:yuva420p
    [libx264 @ 0x2d38ae0] using mv_range_thread = 24
    [libx264 @ 0x2d38ae0] using SAR=1/1
    [libx264 @ 0x2d38ae0] using cpu capabilities: MMX2 SSE2Fast SSEMisalign LZCNT
    [libx264 @ 0x2d38ae0] profile High, level 3.0
    [libx264 @ 0x2d38ae0] 264 - core 132 r2310 76a5c3a - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options:  cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [h264 @ 0x291aa80] detected 8 logical cores
    [h264 @ 0x2920340] detected 8 logical cores
    [h264 @ 0x2935f60] detected 8 logical cores
    [h264 @ 0x29b1040] detected 8 logical cores
    [h264 @ 0x29b3cc0] detected 8 logical cores
    Output #0, mp4, to './woohoo/10_video_out.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf55.4.101
        Stream #0:0, 0, 1/90000: Video: h264, yuv420p, 640x360 [SAR 1:1 DAR 16:9], 1/30, q=-1--1, 90k tbn, 30 tbc
    Stream mapping:
      Stream #0:0 (h264) -> pad
      Stream #0:0 (h264) -> scale
      Stream #1:0 (h264) -> scale
      Stream #2:0 (h264) -> scale
      Stream #3:0 (h264) -> scale
      Stream #4:0 (h264) -> scale
      Stream #5:0 (h264) -> scale
      Stream #6:0 (h264) -> scale
      Stream #7:0 (h264) -> scale
      Stream #8:0 (h264) -> scale
      overlay -> Stream #0:0 (libx264)
    Error while opening decoder for input stream #4:0
    [AVIOContext @ 0x2d2fea0] Statistics: 0 seeks, 0 writeouts
    [AVIOContext @ 0x28dd8e0] Statistics: 71559 bytes read, 2 seeks
    [AVIOContext @ 0x291fae0] Statistics: 70647 bytes read, 2 seeks
    [AVIOContext @ 0x2931c40] Statistics: 71199 bytes read, 2 seeks
    [AVIOContext @ 0x2935e40] Statistics: 71399 bytes read, 2 seeks
    [AVIOContext @ 0x29b3480] Statistics: 71339 bytes read, 2 seeks
    [AVIOContext @ 0x2a2e180] Statistics: 69591 bytes read, 2 seeks
    [AVIOContext @ 0x2a317c0] Statistics: 71147 bytes read, 2 seeks
    [AVIOContext @ 0x2ab4de0] Statistics: 71363 bytes read, 2 seeks
    [AVIOContext @ 0x2c3ab00] Statistics: 71647 bytes read, 2 seeks
    

    The error line

    Error while opening decoder for input stream #4:0
    

    seems to be kind of random to me - at least the streams, ffmpeg fails on changes from time to time.

  • How do i know in the ffmpeg arguments command line what each argument do ?

    24 mai 2013, par Revuen Ben Dror

    I have this code:

    public void Start(string FileName, Bitmap Sample_Bitmap, int BitmapRate )
            {
                p = new NamedPipeServerStream(pipename, PipeDirection.Out, 1, PipeTransmissionMode.Byte);
                byte[] b = new byte[1280 * 720 * 3]; // some buffer for the r g and b of pixels of an image of size 720p 
                System.Diagnostics.Process process = new System.Diagnostics.Process();
                process.StartInfo.FileName = @"D:\pipetest\pipetest\ffmpegx86\ffmpeg.exe";
                process.EnableRaisingEvents = false;
                process.StartInfo.WorkingDirectory = @"D:\pipetest\pipetest\ffmpegx86";
                process.StartInfo.Arguments = @"-f rawvideo -pix_fmt rgb24 -video_size 1280x720 -i
                                              \\.\pipe\mytestpipe -map 0 -c:v libx264 -r " + BitmapRate + " " + FileName;
                process.Start();
    
                process.StartInfo.UseShellExecute = false;
                process.StartInfo.CreateNoWindow = false;
                p.WaitForConnection();
            }
    

    So i know what BitmapRate do and the FileName but the rest of the arguments.

    What odes it mean the -f ? and the rawvideo is that from the decoders or encoders ? -i ? -c:v ? libx264 is a codec i guess and -r ?

    Tried to google for this arguments format but didn't find any.

    I have 4 text files lists:

    encoders.txt decoders.txt in both files i have rawvideo too. I have pixfmts.txt and fileformats.txt files.

    I want to build the arguments string from variables.

    So for example BitmapRate is int and FileName is string. And the rest of the arguments what types of variables each one i should put to get in the function ?

    For example

    the rgb24 what type is it ? the 1280x720 what type of variable it should be ?