Transcode live stream and unwrap from RTMP

228 views
Skip to first unread message

Tomas Vichta

unread,
Jul 19, 2009, 3:25:37 PM7/19/09
to xuggler-users
Hello people,
Im working on my master's thesis and am trying to use red5+xuggler for
this task:
1. receive live stream
2. transcode to any other codec
3. unwrap from RTMP
4. stream using other (not RTMP) protocol (doesn't matter exactly
which, may be RTP, MMS, or pure UDP,...)

I'd like to ask you for help with the points 3. and 4.

I took the VideoTranscoderDemo deployed with red5/xuggler

The code I've adapted is available onhttp://www.vichta.com/red5/PerunTranscoder.java.txt
and should almost be equal to the com.xuggle.red5.Transcoder.java from
the xuggler package.

First I tried to save the outputStream to file (stream resulting from
the transcoding) on line 234, what ended up with the exception,
because the saveAs method isn't implemented. Doesn't matter, it was
only experiment, I need to re-stream the data, not to save into file.

I have attached a IStreamListener successfully to the output stream,
but I haven't found way how to convert the IBroadcastStream and
IStreamPacket instances passed to the IStreamListener.packetReceived()
method to the desired form. I tried to use com.xuggle.xuggler package,
where I ended at the point of conversion between
com.xuggle.xuggler.IPacket and org.​red5.​server.​api.​
stream.IStreamPacket. It isn't described in the documentation and
example at http://build.xuggle.com/view/Stable/job/xuggler_jdk5_stable/javadoc/java/api/com/xuggle/xuggler/IContainer.html

Could anybody give me a clue what to do? I'm totally confused of it.
Thanx very much,
Tomas

Art Clarke

unread,
Jul 19, 2009, 5:58:18 PM7/19/09
to xuggle...@googlegroups.com
Hi Tomas,

You could try this -- instead of writing the re-encode data out to a "redfive:...." URL, write-out to a "file:..." to write a file, or a "rtp:...." etc.

To begin experimenting with different methods that Xuggler can write with, I suggest using ffmpeg's command line tool first.  Take an input file, and start experimenting with:

ffmpeg -i yourfile.flv -vcodec yourcodec -acodec yourcoded -re rtp://127.0.0.1:9999/

Once you've seen that you can do it from ffmpeg, then just use the same URL and codecs with Xuggler.

- Art
--
http://www.xuggle.com/
xu‧ggle (zŭ' gl) v. To freely encode, decode, and experience audio and video.

Use Xuggle to get the power of FFmpeg in Java.

Tomas Vichta

unread,
Jul 25, 2009, 6:23:33 AM7/25/09
to xuggler-users
Hi Art,
thank you for your answer.
The transcoding works well on local filesystem, for example:
ffmeg -i infile.flv -vcodec wmv1 -acodec wmav1 -re outfile.wmv

But if I use "udp://127.0.0.1:1234/outfile.wmv", the transcoding runs,
firewall on my PC indicates, that ffmpeg wants to open udp connection,
but the stream probably doesn't start (vlc player can't play the URI
and the firewall doesn't show outgoing connection). Using "udp://
127.0.0.1:1234/" isn't possible, ffmeg gives error: "Unable to find a
suitable output format for..." The same behavior occurs with rtp://,
rtsp:// and so on...

But I think, the streaming using standalone commandline ffmpeg isn't
important for my task, because I need to stream through red5 server. I
think, I need to create instance of IBroadcastStream, but I can't find
which implementation of the IBroadcastStream could be suitable. I
looked at com.​xuggle.​red5.​io.BroadcastStream class, but it
obviously uses rtmp protocol. Could you say me, what should I use?

Thanks for your time,
Tomas
> >http://build.xuggle.com/view/Stable/job/xuggler_jdk5_stable/javadoc/j...
>
> > Could anybody give me a clue what to do? I'm totally confused of it.
> > Thanx very much,
> > Tomas
>
> --http://www.xuggle.com/
Reply all
Reply to author
Forward
0 new messages