How to use MediaCoder to stream out transcoded video (Stanley posted on April 6th, 2008 )

This is a real scenario in which MediaCoder’s built-in media streaming server can be used. The scenario is like this. All my media files are stored on my powerful Intel Core2 desktop PC. Many of them are high-definition video. I have a legacy PC (Celeron 566Mhz/Windows 2000), and a mobile device (XScale 500Mhz/Windows Mobile 5). I want to playback my HD video on these two devices with LAN and WIFI and without taking time to transcode the video into a low-definition file beforehand. I can just use MediaCoder’s new media streaming server feature.
I must statement that the media streaming server feature is still very EXPERIMENTAL at the moment. You are recommended to upgrade to build 409X or later to use it. You can also use this for audio files.

Step 1: Adding files and choosing format
First I add my files to play into MediaCoder. I set video format to MPEG-1 (audio to MPEG-1 Layer 2). For purposes like playing video on a less-capable device, usually a low-complexity format is preferred. Because when streaming through LAN or WIFI, the bandwidth isn’t a bottleneck. You must know that not all audio/video/container combinations support streaming.

Step 2: Setting resolution and cropping mode
Because the playback device has limited processing power, they can’t afford decoding a high definition video even in a less complex format. So I set resolution to 320×240 (actually 640×480 is proved to be a smooth playback too) and set cropping to “crop to fit” to make the videos fit for square screen regardless of their original aspect ratio.

Step 3: Enabling media server
On the Remote tab, there are several important settings to make. If you want the media server to be accessed by a remote computer, you must set “Listen Address” to “Remote and Local”. This change need restarting of the program to be applied. Media server is not enabled by default and should be enabled by ticking the “Enabled” check box on the tab. Without on-the-fly transcoding enabled, the original video bitstream will be streamed out. In current scenario, it should be enabled.

On restarting, you will be prompted whether to unblock MediaCoder for network access if you have Windows firewall enabled. Click “Unblock”.

Step 4: Getting streaming URL for client playback
Now the server is up running. Let’s go to client side. There need to be a player on the client side. Actually it can be any player that supports the audio and video format we chose on the server as well as streaming via HTTP. There are many choices. VLC or MPlayer are both good for that. I use TCPMP. It’s a light-weight, open-source, portable media player running on many mobile platforms as well as x86 PC.
We need to know the streaming URL. This should be able to be accessed more user-friendly (e.g. making use of uPnP or a fancy web-based UI like a media center), but unfortunately I haven’t yet done with it. Now there are two ways for getting the streaming URL. On server side, click “Show URL” button on “Remote” tab will show you a report containing the URL. On client side, you need to open your browser and enter the media server report URL to get them.
Once getting the URL, we can open the player to enter it.

Step 5: Sit back and watch
If nothing is messed up, the video will be streamed out from the server with scaled down and transcoded on-the-fly. Like this the video is playing by TCPMP on my legacy PC.

Here is TCPMP plays the streaming video on my mobile phone via WIFI.

Links

Yet confirmed stream-able formats

  • Video: MPEG-1/2 (FFmpeg/MEncoder) Audio: MP2/MP3 (FFmpeg) Container: MPEG-1/2
  • Video: H.264 (x264) Audio: disabled Container: Raw Stream (elementary stream)
  • Video: Flash Video Audio: MP3 Container: FLV
  • Video: WMV (FFmpeg) Audio: WMA (FFmpeg) Container: ASF
  • Most audio formats
  • Most video formats when on-the-fly transcoding disabled

6 Responses

  1. Istvan says:

    A very good job …

  2. zoominla says:

    Nice! MediaCoder becomes more and more advanced.

  3. nelson says:

    Using 0.6.1.4100, MC always crashes as soon as I click ‘play’ on the client (VLC 0.8.6f). Sometimes mencoder crashes, others it’s MediaCoder itself.

    The only way for it not to crash is to manually choose FFMPEG as an encoder, however, the video does not play, no matter codec I use, and audio is slow, as if playing half the normal speed.

    I dont know if this has something to do with it, but I often upgrade MC, rather than install it from scratch, and I’ve been doing this since 0.6.0 days.

  4. stanley says:

    4100 has such an issue and I’m fixing it. Please try using a previous build for streaming.

  5. Istvan says:

    Hi Stanley,

    I had two questions:

    1. is it possible to save the stream on the client-pc?

    2. Is it possible to stream via internet. (with a fix IP-adress, of course)

    Thanks.

    Regards,

    I.

  6. Alvin Shark says:

    Hello Stanley

    How do you convert Flash videos to AVI format?

    Thanks