[Libav-user] fps porblem when saving video in mp4 container

Morduhaev, Igor (igorm@stats.com) igorm at stats.com
Sun Nov 25 14:56:10 CET 2012


Carl, firstly thank you for your answer.


1.  You wrote "You could test with ffmpeg (the application) and let the libraries print the values you set in your code to find out which one is wrong"

What do you mean by this? Can give an example?

2.  I ran the command below with ffmpeg I downloaded from http://ffmpeg.zeranoe.com/builds/

"ffmpeg.exe -I c:= C:\\000227_C1_GAME.avi -vcodec libx264 c:\test.mp4"

I wanted to see what params it uses so I could set them in code, but I couldn't map many params to params in code. For example, AVCodecContext missing params "rc", "mbtree", "crf", "ip_ratio". How to set them in code?



C:\Users\igorm\Desktop\ffmpeg-20121029-git-11d695d-win32-shared\bin>ffmpeg.exe -

i c:\000227_C1_GAME.avi -vcodec libx264 c:\test.mp4

ffmpeg version N-46146-g11d695d Copyright (c) 2000-2012 the FFmpeg developers

  built on Oct 29 2012 18:08:23 with gcc 4.7.2 (GCC)

  configuration: --disable-static --enable-shared --enable-gpl --enable-version3

 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib

--enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-

amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut -

-enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger -

-enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --

enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enab

le-libxavs --enable-libxvid --enable-zlib

  libavutil      52.  1.100 / 52.  1.100

  libavcodec     54. 69.100 / 54. 69.100

  libavformat    54. 35.100 / 54. 35.100

  libavdevice    54.  3.100 / 54.  3.100

  libavfilter     3. 20.109 /  3. 20.109

  libswscale      2.  1.101 /  2.  1.101

  libswresample   0. 16.100 /  0. 16.100

  libpostproc    52.  1.100 / 52.  1.100

[mpeg4 @ 0076f420] Invalid and inefficient vfw-avi packed B frames detected

Input #0, avi, from 'c:\000227_C1_GAME.avi':

  Duration: 00:05:59.48, start: 0.000000, bitrate: 1398 kb/s

    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv

420p, 808x610 [SAR 1:1 DAR 404:305], 25 tbr, 25 tbn, 25 tbc

File 'c:\test.mp4' already exists. Overwrite ? [y/N] y

using SAR=1/1

[libx264 @ 025f3c80] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE

4.1 Cache64

[libx264 @ 025f3c80] profile High, level 3.1

[libx264 @ 025f3c80] 264 - core 128 r2216 198a7ea - H.264/MPEG-4 AVC codec - Cop

yleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb

lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m

e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro

ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i

nterlaced=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 scenec

ut=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

Output #0, mp4, to 'c:\test.mp4':

  Metadata:

    encoder         : Lavf54.35.100

    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 808x610 [SAR 1:1

 DAR 404:305], q=-1--1, 12800 tbn, 25 tbc

Stream mapping:

  Stream #0:0 -> #0:0 (mpeg4 -> libx264)

Press [q] to stop, [?] for help

[mpeg4 @ 04ca3840] Invalid and inefficient vfw-avi packed B frames detected

frame=   57 fps=0.0 q=28.0 size=      71kB time=00:00:00.20 bitrate=2896.9kbits/

frame=   89 fps= 88 q=28.0 size=     202kB time=00:00:01.48 bitrate=1117.3kbits/





3.
I tested my code and it does compile! I compile it in VS2010 after configuring "VC++ Directories" in Property Pages of the project. What error do you get?
Here the whole code with includes I use

#include "stdafx.h"

#include "inttypes.h"

extern "C" {
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavutil/avutil.h"
#include <libswscale/swscale.h>
#include <libavutil/opt.h>
#include <libswscale/swscale.h>
#include <libavutil/imgutils.h>
}

#include <iostream>
using namespace sv;
using namespace std;

//TODO: use thread_count to increase converting speed

int main(int argc, char* argv[])
{

       // ****************************************
       //  Here goes the code from my last post
       // ****************************************

       return 0;
}



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121125/4dc66e3e/attachment.html>


More information about the Libav-user mailing list