3

I have several video and audio files on my server that I wish to stream. I have converted all video files to mp4 and audio files to aac.

Now I am streaming both type of files but it seems audio files are taking longer, much longer, to begin playing than videos. Sometimes I can see it buffering the entire file before it starts playing it.

I am not sure if it has any effect but for video files I use the -movflags faststart option and it gets the job done.

I was wondering if there is something similar to be done for audio files to make them start playing faster.

EDIT:

here is how I run the command to convert the files:

ffmpeg -i OriginalPath.wma -strict experimental -c:a aac -b:a 128k -n SomePath.m4a

And I use the HTML5 web player to play them from my server.

Zaid Amir
  • 217

2 Answers2

2

You can still use -movflags +faststart with MP4 & M4A outputs that just contain audio.

llogan
  • 63,280
0

If you have files in m4a (m4a is ipod extension files, so old), then you have to put it into a container friendly for html5, like mp4.

ffmpeg -i SomePath.m4a -c copy -strict -2 audio_friendly.mp4

I think that your problem is your html5 code for playing this audio file, because the -movflags +faststart is only if in you mp4 has videos... this code here is ignored, so in your html file, you have to know the attr and his options

<audio src="audio_friendly.mp4" preload="" controls></audio>

The "preload" option have to be your problem, how do you configure it?

preload

Used for buffering large files; it can take one of three values:

 "none" does not buffer the file
 "auto" buffers the media file
 "metadata" buffers only the metadata for the file

The source for html5 audio

Hashim Aziz
  • 13,835
xear
  • 32