[Libav-user] New libav API usage axamples

Paolo Prete p4olo_prete at yahoo.it
Tue Mar 28 02:13:23 EEST 2017

Il Lunedì 27 Marzo 2017 10:05, Carl Eugen Hoyos <ceffmpeg at gmail.com> ha scritto:


 2017-03-27 9:11 GMT+02:00 Gabor Alsecz <alseczg at gmail.com>:

> Thanks for the code snippet you have pasted here. Many of us
> struggling here because lack of samples even based on the latest API.
> I just can confirm to the Libav team we really would need new API
> examples and please try to figure out the way how Paolo can share
> his snippets commonly.

(Speaking for FFmpeg, not any forks)
If the snippets provide advantages over the code in doc/examples,
please send your patch (against current FFmpeg git head) made
with git format-patch to the FFmpeg development mailing list.
This is also where the feedback comes from.

Carl Eugen
Libav-user mailing list
Libav-user at ffmpeg.org

The snippet I posted could provide these advantages:
1) it can easily be adapted to any audio input source (i.e: a live source)
2) it is short and written in a strict procedural way, without using any function which splits the code with the result of forcing the reader/user to jump from a line to another one in order to understand in details what's happening.
3) all the tasks are separated and all of them are exposed to the user without using functions which hide internal tasks/containers; i.e: muxed data is stored in memory and exposed through a callback function. Therefore, the user can pick specific portions of the code (input raw frame, resampled frame, encoded packet and muxed data) and adapt them to his needings.
4) it can be easily adapted to other audio codecs: I used the aac one, in the example, because it requires a container (adts), then it improves the basic knowledge of the API; but the user can adapt the snippet to mp2 codec, for example, by simply removing the container part, and he can directly write to file the encoded packets.
5) The cleanup stuff is divided into steps.

This message is cross-posted to the ffmpeg-devel mailing list and includes the previous snippet in form of patches in git format-patch (Makefile and snippet files). If it will be accepted, I can provide the next example, which covers h264 encoding, muxing and streaming.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170327/423e95b6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Makefile-changed-in-order-to-include-a-new-API-usage.patch
Type: text/x-patch
Size: 920 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170327/423e95b6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-new-API-usage-example.patch
Type: text/x-patch
Size: 14147 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170327/423e95b6/attachment-0001.bin>

More information about the Libav-user mailing list