[FFmpeg-devel] Wrapping ffmpeg.c

Evan Klinger eklinger at gmail.com
Thu Jul 14 00:55:43 CEST 2011


Hello,
I am trying to create a shared library that wraps most of the
functionality/code in ffmpeg.c into a more user friendly API. The code
is essentially the same as ffmpeg.c except the static variables have
been replaced by a struct with the variables as members, and the
struct is passed around to each function. Also, rather than using
command line options, I am trying to mimic the behavior of FFmpeg's
command line options programmatically. The code is successfully
reading in the video file and creating the output file, but it is not
using any of the settings I am supplying. For example, setting the
audio rate, frame rate, bitrates, etc. Is there anything extra that
must be done for FFmpeg to use these values, other than setting those
static global variables in ffmpeg.c? It seems FFmpeg also uses a
dictionary of settings so I'm not sure if I must add each of the
parameters into that as well?

I have attached the source file, header and test app I am using.

The output of running the test app:

[buffer @ 0x25e4dc0] w:640 h:360 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:
Output #0, mp4, to '/home/eklinger/out.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2011-05-09 17:27:35
    encoder         : Lavf53.5.0
    Stream #0.0(und): Video: mpeg4, yuv420p, 640x360 [PAR 1:1 DAR
16:9], q=2-31, 200 kb/s, 2997 tbn, 29.97 tbc
    Metadata:
      creation_time   : 2011-05-09 17:27:35
    Stream #0.1(und): Audio: libfaac, 44100 Hz, stereo, s16, 64 kb/s
    Metadata:
      creation_time   : 2011-05-09 17:27:35

As you can see it is not using any of the settings I am supplying.

Any help would be greatly appreciated.

Thank you
Evan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: encode-app.c
Type: text/x-csrc
Size: 917 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110713/6ed73b52/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: encoder.c
Type: text/x-csrc
Size: 98709 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110713/6ed73b52/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: encoder.h
Type: text/x-chdr
Size: 11472 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110713/6ed73b52/attachment-0002.bin>


More information about the ffmpeg-devel mailing list