[FFmpeg-user] Fwd: Code which encodes file using MPEG4-codec, decodes the encoded data and then plays the file?

Anders Branderud anders.branderud at gmail.com
Wed Mar 28 13:29:15 CEST 2012

Thanks for the reply!
I want to incorportate this in a code. When I have found a way to code the
below, I will also add Application-FEC (Forward Erasure Correction) from
openfec.org .. It takes chunks of a certain size - e.g. 1024 bytes per
each; and then for all the units of e.g. 1024 bytes it is given, it create
FEC-encoded units of data.

Some FEC-encoded units will contain only parts of a frame; and some
FEC-encoded units will contain several frames.
After FEC-decoding the FEC-encoded units, how will I be able to distinguish
the different frames in the FEC-decoded data?
Thinking of it now when I am writing, I realize that I can add this
information in some bytes of each packet that I send over the network.
Say that I have 25 MPEG4-encoded frames per FEC-encoded unit.
 E.g. if I have five frames in one packet, I could add the following data
in the beginning of the packet sent over UDP:
Nr of the packet sent, number of bytes containing meta data of the
MPEG4-encoded data, byte containing info. whether the first frame of the
packet is the continuation of  a frame sent in the previous packet and info
whether the last frame also is contained in the next packet; nr of bytes of
first frame, nr of bytes of second frame, nr of bytes of third frame, nr of
bytes of fourth frame,  nr of bytes of fifth frame. All bytes, except the
first byte are encoded with FEC.

A fix number of packets are included in each FEC-session - and which
FEC-session a packet belongs to is determined based on the package-number
in the first byte of the received package. The FEC-decoder examines for
each received package of a FEC-session whether the data is decoded yet or
not. When the data is decoded, the FEC-decoder decodes the data. Now, using
the meta data specified above, the program starts doing the following:
Check the second byte, and go through the number of bytes specified by it.
Based on the data in these bytes, reassemble the frames and put them in the
kind of queue/similar that FFMPEG is using for playback (I haven't examined
this yet).
-Do playback continiously of the frames that are next in order to be played
(in a separate thread), at the same time as the decoding takes place.

What do you think of this proposed solution? Would it work? Any more
efficient/better solution? Any example code available for parts of what I
am desiring to implement?


Kind regards, Anders
[Personal blog] Will of the
Creator<http://www.proofexistencegod.com/will-of-god/will-of-god/>  :
reasons - based on scientific premises - for the existence of a Super
intelligent and Orderly Creator and that He hasn't left His sapient
creatures without an Instruction Manual - Torah ['books of Moses'] - to
ascertain, and aspire to, His purpose.

[Company] Anders Branderud IT Solutions - www.abitsolutions.org

---------- Forwarded message ----------
From: dE . <de.techno at gmail.com>
Date: 2012/3/28
Subject: Re: [FFmpeg-user] Code which encodes file using MPEG4-codec,
decodes the encoded data and then plays the file?
To: FFmpeg user questions and RTFMs <ffmpeg-user at ffmpeg.org>

On 03/28/12 01:11, Anders Branderud wrote:

> Hello!
> I wondered if anyone has created a code which does the following:
> Encodes file using MPEG4-codec, decodes the encoded data; and play each 25
> frames continiously as 25 new frames are decoded (If so, I would be very
> thankful to get it mailed to me!)?
> I am aware of the decoding_encoding.c-example (in /doc/examples of the
> FFMPEG-library) and wonder which changes that are needed to be made in
> order to accomplish this?
> Thanks in advance!
Are you going to incorporate this in a code? If not, you may use pipe, but
if you want blocks of 25 frames, I'm not sure...
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org

More information about the ffmpeg-user mailing list