Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to find the actual size occupied by an AVFrame ?

    23 septembre 2013, par jsp99

    The main task at hand is to find the actual size of a decoded AVFrame.

    Here is some background information about the problem -
    I wrote a program which takes as input a media file and displays all the video frames of the file, on the screen. My Code (written in C using SDL and ffmpeg) worked perfectly with .wmv files. When it came to .mkv files, it failed (SIGSEGV) due to the following reason :

    Example : Suppose I have a decoded frame from my video stream of file (filename.mkv) in AVFrame *pFrame. The frame has a pix_fmt (pFrame->pix_fmt) of yuv420p. It has dimensions 640 * 346. The Y-plane has it's linesize (pFrame->linesize[0]) as 672.

    I think you get the point here. When I use avpicture_get_size() to get the size of the frame, it calculates a wrong size. It takes pix_fmt, width and height as arguments. Nowhere does it consider 672 instead of 640.

    avpicture_get_size() : Calculates the size in bytes that a picture of the given width and height would occupy if stored in the given picture format.

    I got around this problem by adding some yuv420p frame specific code, which can find the size of the frame in situations like above.

    • Can someone explain why are most of the decoded frames (from video streams of most of the formats) this way? And why is it not this way with the wmv format?

    But if I have to find the actual size occupied by an AVFrame of another format (Eg: yuv410p), I have to write the format specific code again. Coming to the main problem,

    • How can I find the actual size occupied the decoded AVFrame (size in bytes occupied by the data of the AVFrame) ?

    • I tried using av_image_get_buffer_size(), but I couldn't understand how to use the align parameter. Can someone explain the usage of the parameter align? Tried using many other functions in pixdesc.c, but I am missing something.

  • ffmpeg not adding all images when creating video [on hold]

    23 septembre 2013, par travisb

    I am creating a video from 38,179 images. ffmpeg successfully creates a video but only includes the first 20,998 images. I am running Windows 7 64-bit.

    The files are all in the same directory and named 1000000.jpg - 1038179.jpg.

    This is the command I used:

    ffmpeg -f image2 -r 18 -i 1%6d.jpg a.mp4
    

    How can I get it to include all the images?

    This is the last screen of output:

    frame=20998 fps=6.4 q=27.0 size=  478740kB time=00:19:23.66 bitrate=3370.2kbits/
    frame=20998 fps=6.4 q=27.0 size=  478740kB time=00:19:23.66 bitrate=3370.2kbits/
    frame=20998 fps=6.4 q=27.0 size=  478740kB time=00:19:23.66 bitrate=3370.2kbits/
    frame=20998 fps=6.4 q=27.0 size=  478740kB time=00:19:23.66 bitrate=3370.2kbits/
    frame=20998 fps=6.4 q=27.0 size=  478740kB time=00:19:23.66 bitrate=3370.2kbits/
    frame=20998 fps=6.4 q=-1.0 Lsize=  480427kB time=00:19:26.44 bitrate=3374.1kbits
    /s dup=0 drop=17182
    video:480204kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.046423%
    
    [libx264 @ 00000000041aa020] frame I:332   Avg QP:18.87  size:110978
    [libx264 @ 00000000041aa020] frame P:10468 Avg QP:21.59  size: 32633
    [libx264 @ 00000000041aa020] frame B:10198 Avg QP:23.35  size: 11108
    [libx264 @ 00000000041aa020] consecutive B-frames: 22.7% 35.1%  7.9% 34.3%
    [libx264 @ 00000000041aa020] mb I  I16..4: 13.2% 84.6%  2.2%
    [libx264 @ 00000000041aa020] mb P  I16..4:  9.6% 30.7%  0.3%  P16..4: 30.1%  6.9%  3.0%  0.0%  0.0%    skip:19.4%
    [libx264 @ 00000000041aa020] mb B  I16..4:  1.3%  4.4%  0.0%  B16..8: 33.4%  3.3%  0.4%  direct: 2.2%  skip:54.9%  L0:43.9% L1:51.4% BI: 4.8%
    [libx264 @ 00000000041aa020] 8x8 transform intra:76.3% inter:90.0%
    [libx264 @ 00000000041aa020] coded y,uvDC,uvAC intra: 46.6% 62.7% 10.4% inter: 12.3% 22.3% 0.5%
    [libx264 @ 00000000041aa020] i16 v,h,dc,p: 42% 24%  9% 25%
    [libx264 @ 00000000041aa020] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 22% 33%  2%  2% 3%  2%  3%  2%
    [libx264 @ 00000000041aa020] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 16% 11%  5% 10% 12%  7%  6%  3%
    [libx264 @ 00000000041aa020] i8c dc,h,v,p: 46% 23% 27%  4%
    [libx264 @ 00000000041aa020] Weighted P-Frames: Y:1.0% UV:0.5%
    [libx264 @ 00000000041aa020] ref P L0: 65.7% 11.6% 17.0%  5.7%  0.0%
    [libx264 @ 00000000041aa020] ref B L0: 86.8% 11.6%  1.6%
    [libx264 @ 00000000041aa020] ref B L1: 96.3%  3.7%
    [libx264 @ 00000000041aa020] kb/s:3372.17
    
  • Why FFMPEG's -movflags faststart parameter makes empty files when output is over network drives ?

    23 septembre 2013, par bokan

    I made an application that uses ffmpeg to compress video files. There are 3 computers crunching the files from and to a Synology NAS.

    Everything works great, but if I add the parameter "-movflags faststart" the resulting file ends being 0Kb.

    The same commands works well if output file is on local hard drive.

    I need this parameter to move the moov atom at the begining so making the file suitable for progressive download.

  • /solved/ _stricoll is unsolved while linking the libmingwex.a with vs2010

    23 septembre 2013, par damantou

    Brief answer:

    In MinGW libs, the symbol _stricoll is defined in libmoldname100.a.
    

    Question:

    I am tending to build some app which staticly links the ffmpeg libs on windows 8. I have successfully build the static lib of ffmpeg in mingw/msys env on windows 8. Then I use cmake to generate the vs2010 project to start work with my app.

    While I am trying to build the first dead simple main program, I got quite some link errors.

    extern "C" {
    
    // to work around error:
    // 'UINT64_C': identifier not found
    #ifndef __STDC_CONSTANT_MACROS
    #define __STDC_CONSTANT_MACROS
    #endif
    
    
    #include avcodec.h>
    #include avformat.h>
    #include swscale.h>
    
    }
    
    
    int main(int argc, char *argv[])
    {
        av_register_all();
        return 0;
    }
    

    After struggling with a bunch of unresolved symbols, I come up with the following libraries to link with in order:

    c:/MinGW/mingw32/lib/libiconv.a
    libavcodec.a
    libavdevice.a
    libavfilter.a
    libavformat.a
    libavutil.a
    libswresample.a
    libswscale.a
    c:/MinGW/lib/gcc/mingw32/4.8.1/libgcc.a
    c:/MinGW/mingw32/lib/libws2_32.a
    c:/MinGW/mingw32/lib/libmingw32.a
    c:/MinGW/mingw32/lib/libmingwex.a
    

    Finally there is one unresolved symbol issue not able to fix:

    libmingwex.a(glob.o) : error LNK2019: unresolved external symbol 
                           _stricoll referenced in function _glob_match
    

    I tried to add some a fake function, but still not help :(

    int  __cdecl _stricoll(_In_z_  const char * _Str1, _In_z_  const char * _Str2)
    {
        return 0;
    };
    

    I googled it the whole morning, but nobody ever mentioned this problem. I guess there should be simple reason and solution for this, maybe because of my ignorance on simple knowledge.

  • creating thumbnail from a video using ffmpeg in php exec() returns 1 but returns 0 if command is 'ffmpeg -h'

    23 septembre 2013, par user2807517

    creating thumbnail from a video using ffmpeg in php exec() returns 1 but returns 0 if command is 'ffmpeg -h'. i am using ubuntu. A portion of my code is as shown bellow. When i tried $cmd it returned 1 and when i tried $cmd1 it worked.

    $ffmpeg = 'ffmpeg';
    $getFromSecond = 5;
    $videoFile = $_FILES['file']['tmp_name'];
    $size = '105x73';
    $imageFile = 'Newimage.jpg';
    
    $cmd = "$ffmpeg -an -ss $getFromSecond -i $videoFile -vframes 1 -s $size $imageFile";
    $cmd1 = "$ffmpeg -h";
    

    works for $cmd1 but not for $cmd, i am thinking it is permission issues