[Libav-user] ReZound Integration Question

Davy Durham ddurham at davyandbeth.com
Mon Oct 8 19:25:19 CEST 2012


I need some advice on integration.

I'm experimenting with changing rezound (a destructive audio editor) to 
use libavcodec/libavformat instead of its current use of many other 
libraries (libsndfile, libaudiofile, lame, manual coding in some places, 
etc).  I did all of that work a LONG time ago.

*Q1:*
So, loading audio files that might have multiple streams is rather 
straight forward in concept.. I don't think users of rezound would 
normally load files with multiple streams (e.g. video files), but I can 
certainly enumerate the audio streams and present the user with a choice 
of which audio stream to load.  Let's call that chosen stream "stream X".

So then if the user chooses the save the file after doing their editing, 
is it feasible (with libavformat) to replace stream X in the original 
file leaving all other streams intact?  I'm guessing this could be done 
(in concept) by opening a new temp file for write, and re-opening the 
original file for reading.  Then as I read the packets from the file, if 
the packet was for some other stream, then I just write it verbatim to 
the new file, but if the packet was for stream X, then I write the new 
encoded packet to the new file. Then when it's all done, I move the tmp 
file back to the original file.    This would generally preserve the 
interlacing of packets within the file.  I assume it would be a bad idea 
to simply drop all the original file's packets for !stream X and then 
simply append stream X's new packets to the end of the file.

So that, or is that kind of functionality already built into 
libavformat?  (i.e. functionality to /rewrite/ one of the streams within 
a file)


*Q2:*
It's daunting to consider the type and extent of UI  that needs to be in 
place if a user chooses to save a file in a chosen format with a chosen 
codec.  That is, just how many little options and their sensible 
defaults would need to be presented to the user for all the minutia of 
all the supported audio codecs.  Does ffmpeg provide any sort of 
programatic enumeration of the parameters (along with their name, 
data-type, defaults, etc) that need to be specified in the encode 
operation?  I don't immediately see something like a struct for each 
supported codec that describes all the options for that codec.  [Did I 
miss it?]

Also, is there a way to know from the library what codecs are supported 
by a given muxer?  (just beginning to look at how -formats, -decodes, 
-encoders) work

---

As you can tell, I'm just beginning to look at the idea of switching to 
ffmpeg.  I'm looking at the ffplay code (which only helps with 
understanding how to read).   I've found the doxygen code and the 
api-example.c (which only helps with libavcodec).   Are there other good 
resources for figuring this stuff out?

Thanks.  Any suggestions, guidance, ideas, warnings, etc are appreciated.

-- Davy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121008/6d026246/attachment.html>


More information about the Libav-user mailing list