[Ffmpeg-devel] using apiexample.c

Riccardo Zanella znlrcr
Tue Nov 14 12:14:40 CET 2006


Michel Bardiaux ha scritto:
> Riccardo Zanella wrote:
>> Hello,
>>
>> I'm using apiexample.c to learn how to encode video.
>> I want to be able to set the bitrate, so i think I have to modify
>> this line:
>>
>> c->bit_rate = 400000;
>>
>> where c is AVCodecContext*.
>>
>> But it seems it doesn't work: the bitrate of the output stream isn't
>> affected by the modification.
> 
> How do you know that? What does ffmpeg -i say about your output file?

If i compile and run apiexample.c with:

c->bit_rate = 400000;

FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
   configuration:  --shlibdir=/usr/lib64 --prefix=/usr 
--mandir=/usr/share/man --libdir=/usr/lib64 --enable-shared 
--enable-mp3lame --enable-libogg --enable-vorbis --enable-faad 
--enable-faac --enable-xvid --enable-a52 --enable-x264 --enable-pp 
--enable-gpl --enable-gprof --enable-amr_nb --enable-amr_wb
   libavutil version: 49.0.0
   libavcodec version: 51.11.0
   libavformat version: 50.5.0
   built on Aug 18 2006 12:56:43, gcc: 4.0.2 20050901 (prerelease) (SUSE 
Linux)
Input #0, mpegvideo, from 'test.mpg':
   Duration: 00:00:00.0, start: 0.000000, bitrate: -2147483 kb/s
   Stream #0.0: Video: mpeg1video, yuv420p, 352x288, 104857 kb/s, 25.00 
fps(r)
Must supply at least one output file

If i compile and run apiexample.c with:

c->bit_rate = 800000;

FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
   configuration:  --shlibdir=/usr/lib64 --prefix=/usr 
--mandir=/usr/share/man --libdir=/usr/lib64 --enable-shared 
--enable-mp3lame --enable-libogg --enable-vorbis --enable-faad 
--enable-faac --enable-xvid --enable-a52 --enable-x264 --enable-pp 
--enable-gpl --enable-gprof --enable-amr_nb --enable-amr_wb
   libavutil version: 49.0.0
   libavcodec version: 51.11.0
   libavformat version: 50.5.0
   built on Aug 18 2006 12:56:43, gcc: 4.0.2 20050901 (prerelease) (SUSE 
Linux)
Input #0, mpegvideo, from 'test.mpg':
   Duration: 00:00:00.0, start: 0.000000, bitrate: -2147483 kb/s
   Stream #0.0: Video: mpeg1video, yuv420p, 352x288, 104857 kb/s, 25.00 
fps(r)
Must supply at least one output file

By the way, the two output files provided have the same size:

ricky at MAN-10-16-2-180:~/Lavoro/libffwrap2/apiexample/test>ls -l *.mpg
-rw-r--r--  1 ricky users 94786 2006-11-13 12:42 test4.mpg
-rw-r--r--  1 ricky users 94786 2006-11-14 12:06 test8.mpg

where
test4.mpg  has  c->bit_rate = 400000
test8.mpg  has  c->bit_rate = 800000

> BTW this belongs on ffmpeg-user, not here.

Yes, you are right, but in the other list no one has responded.

I'm using SUSE 10.0 on athlon64, gcc version 4.0.2 20050901 (prerelease) 
(SUSE Linux)





More information about the ffmpeg-devel mailing list