[FFmpeg-user] From mp3 to fixed-length swf/flv/f4v

Eduardo Costa ecosta.tmp at gmail.com
Wed May 15 12:03:32 CEST 2013


Hi guys,

I'm trying to convert mp3 files to swf (or f4v/flv, but haven't looked
at these formats in depth, see below for my question regarding them).

The point is being able to do http audio-streamming for a flash
audio-player. So I started with a command like this:

`ffmpeg -i input.mp3 -acodec copy -vcodec copy out.swf'

Which gives me the mp3 cut at frame boundaries, and dispossed as swf
frames. I could load the resulting file from flash and works like a
charm.

The only problem is that from within the swf file, I can see some
(mp3) frames being 421 bytes long, others 422, randomly. This seems to
be how the mp3 works, though I've read mp3's header has a padding bit.

My question is, is it possible to force ffmpeg to output mp3 frames of
same length? perhaps even adding whatever's necessary no-ops the last
frame so even it is of same length as the rest?

Regarding f4v/flv formats, I could also use these to contain my mp3
files, so here I'd be seeking for hints on wheter to use one or the
other based on the following criteria:

Whenever possible, I'd prefer to work based on fixed-length blocks.
There's a cgi streamming these mp3's, and so it would be much ligther
if it could just take byte offsets as input, than anything else
forcing me to open and parse/seek until the desired block is found
(which would happen for every client of this cgi).

I've also seen another widely-used method which is embedding metadata
on the resulting file, which is basically a mapping of blocks and it's
sizes the player can use to build a proper request to the server.

But I'd prefer avoiding such computational-overhead for the player, if
possible. I don't actually understand why would anybody go this way
instead of the former, at least for audio, unless for some reason,
maximum granularity or control over the file is not wanted.

Well, thanks for any hints,

Regards,


More information about the ffmpeg-user mailing list