SDL_movie

From Fri, 26 Jan 2007 00:34:47 -0500
Simon <simon.xhz at gmail.com> wrote:

This is something to be looked into. My first FFMPEG project was to
first render specific movies in POV-Ray: movies that would try to
produce artefacts in different codecs and compare the decoded frame
with the original, thus finding the best codec for this kind of
movie. Kinds of movies are what you see all the time on the web,
colors slowly fading to another color, but the artifact doesn’t show
the fade and just abruptly changes, squares artifacts, etc…
Well, I do a lot of video encoding and from my experience I can tell
that choosing a codec for a specific task is generally easy: if you
want quick encoding times, don’t care too much about tight compression
and want small details kept, use ffmpeg’s MPEG2 encoder. If you need much
better compression rates at the cost of some small details being lost,
use XviD which is IMHO better than all other MPEG4 clones out there
(including the one included in ffmpeg). And, finally, if you need very
tight compression and don’t care about compression times, use x264,
which is ~2-3 times slower than XviD, but gives better results,
especially on low bitrates. In this scheme Theora is somewhere around
the middle, e.g. comparable to XviD, although I haven’t used it a lot.

Also keep in mind that MPEG2, MPEG4 and h264 are covered by various
patents, so be careful if you do esp. commercial applications.

Obviously, my aim was to make a benchmark of this as well and then
provide the results showing overall, in any kind of video situation,
which is the best codec… (h264, yea maybe, i wanna make sure!)
There’s no ‘best’ codec, you must know what you’re using it for. If you
have 8 megabits of bandwidth, MPEG2 will give the best results, and if
you compress your video stream into 300 kilobits (at dvd resolution),
h264 will give you best results.–
Andrew

I’m glad to see Scott Harper is already on his way with SDL+ffmpeg.
Scott don’t worry about creating the final lib…Once you have it all
working, creating a simple unit test, documenting and packaging it
all up
should be the easy part :wink: You can just look at other libs
(SDL_mixer,
SDL_ttf, etc.) to see how other people have done it.

Heck, just give us source to something that works and we’ll clean
it up
into a simple API. :slight_smile:

Hello again. I’ve been busy with some school, and also with
programming. I ran into a rather significant stumbling block,
doubtlessly brought on by the fact that I tried to incorporate some
amount of multi-threading into my program (simultaneous decoding of
audio/video, independent of the screen redraw)… Though perhaps
not. Unfortunately, I don’t have enough free time to spend beating
my head against the keyboard until I understand everything fully
enough to get it right.

The problem I ran into was audio decoding. I have looked into the
ffplay.c code, which is very interesting, and not TOO far different
from what I intend on doing for reading/decoding video/audio, with
the exception that ffplay works. ^_^;; There’s a significant key
difference, however, in that ffplay doesn’t use the newer
av_read_frame() function when reading data form the stream. This
function works wonderfully when decoding the video frames (as I’m
certain that was its intent) as it’s much simpler than piecing
together a complete frame from packets.

Unfortunately, I SUSPECT (though am by no means certain) that the
av_read_frame() function has proven to be my downfall in decoding
AUDIO. I have tried to copy the ffplay code as closely as I can
(according to my understanding of it), but all the audio I get is
garbage. Garbage in such a way that I’m not even sure my function is
ACTUALLY decoding ANYTHING… or at least properly returning any
decided data.

Does anyone have any (simple is key here) examples of audio decoding
using ffmpeg and SDL for playback? Especially using av_read_frame()
for getting data versus av_read_packet()? I don’t care about audio
sync right now or anything. I have searched in my freer time for
something and there seem to be frighteningly few examples online (I
found maybe 2 examples, both of which may have been ffplay, I don’t
remember, and none of which were simple; simple being perhaps less
than 3-5 pages printed out), and those who have looked I’m sure have
noticed that the documentation for ffmpeg’s libraries is rather
lacking in details for the beginner.

I would love to get back on this project, but am afraid I can’t right
now without help from someone who knows what they’re doing.

Any help, as always, is greatly appreciated,
– ScottOn Jan 25, 2007, at 11:29 AM, Ryan C. Gordon wrote: