Problems trying to play RTSP stream from VLC in Android

About encoding, codec settings, muxers and filter usage
mark@m1tech.net
New Cone
New Cone
Posts: 4
Joined: 26 Apr 2009 19:44

Problems trying to play RTSP stream from VLC in Android

Postby mark@m1tech.net » 26 Apr 2009 19:53

Hi,

I posted this to one of the Android dev groups and I thought it would be a good idea to put it here as well. Thanks for any info...

------------

For the last few days I've been trying to play an RTSP stream on the
physical device (dev phone) from an instance of VLC (0.9.9) running on
my machine, but I've had no success.

I started with some mp4 video files that I verified will play off the
SD card on the device. I took one of these files and published an
RTSP stream from an instance of a VLC server running on my laptop.
Here's the output string in VLC that is used to create the stream from
the base mp4:

:sout=#transcode
{vcodec=mp4v,vb=200,scale=1,acodec=mp4a,ab=16,channels=2}:duplicate
{dst=display,dst=rtp{dst=,mux=ts,port=1234,sdp=rtsp://
192.168.1.100:1234/stream.sdp}}

Which corresponds to:

Video codec - MPEG-4
Audio codec - AAC
Video bitrate - 200 kbps
Audio bitrate - 16 kbps
Resolution - 320x240

I can publish this stream in the VLC server and consume it from a VLC
player (running on the same machine as the server or from another
machine on the network) without any problems by simply telling it to
play the stream at this address:

rtsp://192.168.1.100:1234/stream.sdp

The problem I'm having is trying to play this same stream from the
device. I'm using the 1.1 release of the SDK, and the project I'm
using to test this is the ApiDemos project
(MediaPlayerDemo_Video.java). All I'm doing is setting the "path"
variable in code to the rtsp:// link above. When this line executes:

mMediaPlayer.prepare();

This exception is thrown:

java.io.IOException: Prepare failed.: status=0xFFFFFFFF

So it's not clear to me what exactly the failure is. I've tried
tinkering with the VLC output a million different ways, but I can't
get around this error. I've tried using several different mp4 source
files and even some wmv's.

I'm by no means an expert in streaming video protocols, but it seems
that VLC may not be able to produce an RTSP stream that Android is
able to recognize, and that's really what I'm looking for an answer
to. I'm hoping someone has been able to take an mp4 file (or a source
file of any video format, really) and, in VLC, transcode it and make
it available in an RTSP stream that the device is able to play back.
I've read some other posts that are semi-related to the RTSP issues
I'm seeing here, but I don't think I've seen anything yet where
someone confirmed outright that they were able to play an RTSP stream
from VLC to Android. I'm going to post this in the VideoLAN forums as
well. Any help is appreciated. Thanks.

Rémi Denis-Courmont
Developer
Developer
Posts: 15229
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Problems trying to play RTSP stream from VLC in Android

Postby Rémi Denis-Courmont » 27 Apr 2009 21:02

That's an Android problem, we cannot help you. Quite likely that Android does not like the video format though.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

mark@m1tech.net
New Cone
New Cone
Posts: 4
Joined: 26 Apr 2009 19:44

Re: Problems trying to play RTSP stream from VLC in Android

Postby mark@m1tech.net » 27 Apr 2009 21:19

Yes, I'm thinking it's most likely an issue on the Android side, but I was hoping by an off-chance that someone here had already been down the same path as me and had figured out the magical combination to get the rtsp stream working from VLC to Android. Thanks for the reply.

wizzbit
New Cone
New Cone
Posts: 1
Joined: 29 Apr 2009 12:47

Re: Problems trying to play RTSP stream from VLC in Android

Postby wizzbit » 29 Apr 2009 13:10

Well... it's not an Android problem, and i'm quite sure about that, it play's streams good from vlc 0.8.6h, because Nokia N95 realplayer does not understand it either when i use 0.9.9 but it does when i use 0.8.6h.
While Android sometimes start playing the stream, but the nokia player saids, "Loading" and starts playing with a black screen..
There's something changed on the mpeg-4 codec i suppose.
When i use 0.8.6h it works fine on both phones, but with the exactly same setup on 0.9.9, but then it won't stream anymore.
Sometimes even VLC saids "No stream for 10 seconds".

vlc -vvv http://AXIS-CAM-IP:9080/mjpg/video.mjpg -I dummy --sout "#transcode{vcodec=mp4v,vb=300,width=320,height=240,fps=25}:rtp{dst=0.0.0.0,port=1234,sdp=file:///usr/local/movies/t.sdp}"');

It goes thru a Darwin server, that server hasn't been changed, only vlc version is changed from 0.8.6h to 0.9.9, and when i went back to 0.8.6h it worked on all devices again, so something has changed in the codecs somewhere i think.
The difference i see with 0.9.9 and 0.8.6h that 0.9.9 uses the avcodec encoder to encode mpeg4 and 0.8.6h ffmpeg encoder.
I've been struggling with 0.9.9 also to get it to work properly, but somehow it won't succeed.
For now i went back to 0.8.6h for transcoding.
It could be that avcodec does something strange, but i can't seem to force it to use ffmpeg as encoder, it always uses the avcodec.

Greetz,

Eric-Jan

A little thing i need to add..
When i use h264 codec the phone's start to give an image as soon as i quit the vlc streaming.. quite strange.. On the nokia it plays for a few seconds very fast like it needs to catch up with the frames and a second or 2 normal , on android it plays normal, but also after i quited streaming..

mark@m1tech.net
New Cone
New Cone
Posts: 4
Joined: 26 Apr 2009 19:44

Re: Problems trying to play RTSP stream from VLC in Android

Postby mark@m1tech.net » 29 Apr 2009 18:13

Ahhh....that is great information. The v1.5 firmware update was just released for the phone, so I'm going to try 0.9.9 again against that first. If I verify that I still can't get things working (I don't see that anything has changed in 1.5 that would affect RTSP), I'll load up VLC 0.8.6 as you suggest to see if I can get the stream going. Thanks!

Mark

plun
New Cone
New Cone
Posts: 1
Joined: 24 Aug 2009 19:57

Re: Problems trying to play RTSP stream from VLC in Android

Postby plun » 24 Aug 2009 20:01

Was this ever resolved? I tried both 0.8.6h and the new 1.0.1 without success. I need to stream vlc sdp from android. It works from vlc player to vlc player. I'm just using androids mediaplayer to access the rtsp address.

How did you guys get it to work?

mark@m1tech.net
New Cone
New Cone
Posts: 4
Joined: 26 Apr 2009 19:44

Re: Problems trying to play RTSP stream from VLC in Android

Postby mark@m1tech.net » 25 Aug 2009 02:56

Sorry plun, I never got a chance to go back and try it again since I made the original post, so I can't say if RTSP will really work from VLC to Android...

DarkFox
New Cone
New Cone
Posts: 3
Joined: 30 Aug 2009 02:45

Re: Problems trying to play RTSP stream from VLC in Android

Postby DarkFox » 30 Aug 2009 02:53

I just set up DSS and tried to get this working, but couldn't.

It may be that the stream isn't correctly transcoded..

Code: Select all

vlc -vvv file:///usr/local/movies/sample_300kbit.mp4 -I dummy --sout "#transcode{vcodec=mp4v,vb=300,width=320,height=240,fps=25}:rtp{dst=0.0.0.0,port=1234,sdp=file:///usr/local/movies/t.sdp}"
Works.

Code: Select all

vlc -vvv rtsp://streamer-01.dr.nordija.dk/dr1lowmp4 -I dummy --sout "#transcode{vcodec=mp4v,vb=300,width=320,height=240,fps=25}:rtp{dst=0.0.0.0,port=1234,sdp=file:///usr/local/movies/t.sdp}"
Doesn't.

Perhaps the arguments changed from 0.8.5 to 0.9.9?

DarkFox
New Cone
New Cone
Posts: 3
Joined: 30 Aug 2009 02:45

Re: Problems trying to play RTSP stream from VLC in Android

Postby DarkFox » 30 Aug 2009 04:11

So after looking around on the forum I found the transform arguments for baseline profile h264 and android almost takes it.

Code: Select all

vlc -vvv rtsp://streamer-01.dr.nordija.dk/dr1lowmp4 -I dummy --sout "#transcode{vcodec=h264,venc=x264{no-cabac,level=3.0,subme=5,trellis=1,merange=16,min-keyint=25,scenecut=40,ipratio=0.71,ratetol=20k,vbv-maxrate=96k,vbv-bufsize=96k,qcomp=0.6,qpmin=10,qpmax=51,qpstep=4,keyint=30,ref=1,deblock=0:0,aud},scale=1,acodec=mp4a,ab=128,samplerate=48000,channels=2,width=320,height=240}:rtp{dst=0.0.0.0,port=1234,sdp=file:///usr/local/movies/t.sdp}"
It's a bit choppy though and some times crashes the phone.

ILEoo
Developer
Developer
Posts: 91
Joined: 05 Nov 2008 16:29

Re: Problems trying to play RTSP stream from VLC in Android

Postby ILEoo » 31 Aug 2009 09:44

No wonder it's choppy with those bitrates. Try something like this: "#transcode{vcodec=h264,venc=x264{no-cabac,level=12,vbv-maxrate=384,vbv-bufsize=1000,keyint=75,ref=3,bframes=0},width=320,height=240,acodec=mp4a,ab=128,vb=384}:rtp{sdp=file:///usr/local/movies/t.sdp,mp4a-latm}"

DarkFox
New Cone
New Cone
Posts: 3
Joined: 30 Aug 2009 02:45

Re: Problems trying to play RTSP stream from VLC in Android

Postby DarkFox » 31 Aug 2009 11:33

No wonder it's choppy with those bitrates. Try something like this: "#transcode{vcodec=h264,venc=x264{no-cabac,level=12,vbv-maxrate=384,vbv-bufsize=1000,keyint=75,ref=3,bframes=0},width=320,height=240,acodec=mp4a,ab=128,vb=384}:rtp{sdp=file:///usr/local/movies/t.sdp,mp4a-latm}"
Oh yeah, good point :P

Tweaked it a bit to fit the resolution and lowered the audio bitrate... (thinking of lowering it more)...

"#transcode{vcodec=h264,venc=x264{no-cabac,level=12,vbv-maxrate=384,vbv-bufsize=1000,keyint=75,ref=3,bframes=0},width=320,height=180,acodec=mp4a,ab=64,vb=384}:rtp{dst=0.0.0.0,port=1234,sdp=file:///usr/local/movies/t.sdp,mp4a-latm}"


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 27 guests