[Live-devel] Stream MP3 over TS

Ross Finlayson finlayson at live555.com
Sun Oct 6 01:06:54 PDT 2013


> I'm trying to transmit an MP3 file over Transport Stream

Note that a "Transport Stream" is really just a container (i.e. file) format, not a network protocol.  So it doesn't really make sense to talk about streaming anything over a "Transport Stream".  You can, however, convert, or 'pack' some data type (including MP3 audio) into a Transport Stream file.


> I studied the 2 test programs testMP3Streamer and testMPEG2TransportStreamer, but I didn't understand how it can work.

Those applications are used to stream MP3 and Transport Stream files (respectively) using the standard RTP protocol.


If you want to convert (not stream) a MP3 file into a Transport Stream file, then you should be able to do so - using our software - by feeding a "MP3FileSource" object into a Transport Stream, by doing something like:
	FramedSource* audioSource = MP3FileSource(*env, mp3FileName);
	MPEG2TransportStreamFromESSource* tsFrames = MPEG2TransportStreamFromESSource::createNew(*env);
	tsFrames->addNewAudioSource(audioSource, mpegVersion);
		// Where "mpegVersion" is either 1 or 2, depending on whether your MP3 audio is MPEG-1 or MPEG-2
	MediaSink* outputSink = FileSink::createNew(*env, outputFileName);
	outputSink->startPlaying(*tsFrames, afterPlaying, NULL);

(See the "testH264VideoToTransportStream" code for an illustration of how we can convert a H.264 video file into a Transport Stream.)

However, if you just want to stream a MP3 file over the network, then by far the best way to do this is to stream it via RTP - e.g., using our "testMP3Streamer" demo application, without using Transport Streams at all.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20131006/dc157457/attachment.html>


More information about the live-devel mailing list