Hi Damian,
Damian Mierzwiński wrote:
> Hello,
> I'm working on some web services which converts some arbitrary movies format
> to specific one. I used to fire ffmpeg and let it do the job, however some
> info about the process state (e.g. what part of frames has been as far
> proceeded) would be nice.
ffmpeg prints the timestamp of the last converted frame, so you should be
able to get some information by parsing stderr.
> I tried to use libavformat and libavcodec, but it
> seems rather complicated to me. I've read output_example, Martin Böhme
> articles and Stephen Dranger tutorial, but I still couldn't figure out the
> whole process of first decoding and then encoding media. I've tried to
> search in the mailing archives but with no result as well.
> Could you be so kind and point some threads for me or (what be the most
> helpful) examples that covers the whole processing I need?
Useless to say, the best example code is contained in ffmpeg.c ;-)
Basically, what you need to do is:
1) Initialise the input and output codecs and formats (look at
output_example.c for initialising the output part, and at Dranger's
tutorial for the input part).
2) Enter a loop that cyclically:
a) Read a frame from the input stream (look at tools/pktdumper.c,
or Dranger's tutorial)
b) Decode the frame (look at libavcodec/apiexample.c,
ffmpeg.c:output_packet(), or at Dranger's tutorial)
c) Encode the frame (look at ffmpeg.c:output_packet() or
output_example.c)
d) Writes the frame to the output file (again ffmpeg.c or
output_example.c).
ffmpeg.c's code is complex because it implements a lot of features
(rescaling, colorspace conversion, stream copy, support for multiple
input files, etc...) but it can give some useful hints.
If you have more specific questions, feel free to ask (possibly posting
the code that does not work for you).
Luca
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user