Recording RTSP/mpeg4 stream to file - timebase is *screwed*

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
lerxst
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Jan 2007 19:18
Location: Traverse City, MI
Contact:

Recording RTSP/mpeg4 stream to file - timebase is *screwed*

Postby lerxst » 08 Feb 2007 18:47

Hello all,
I've been trying to get an rtsp/mpeg4 stream from an Axis camera recorded to a file.
The stream looks beautiful in Quicktime on windows/os x, and will reliably display for as long as it's left open receiving the stream

In VLC, viewing the stream looks great on all tested platforms including debian, ubuntu, OS X, and Win32.

However, when we record to a file, either it's dropping frames, or it just horribly skews the timebase. Playback looks, quite honestly, like complete crap. You'll have a few initial frames, a pause, then like 50 frames blasted horribly quickly, another pause, etc... and it just keeps doing this.

Say I record 25 minutes of content, and end up with a few-hundred megs data. if I load the file, it will report about 16 minutes total time, and aside from being jerky as all hell, it's *really* fast during the bursts.

Am I missing something, or is this a known flaw?

-jre
-jre

lerxst
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Jan 2007 19:18
Location: Traverse City, MI
Contact:

Still trying to get this working! help!!

Postby lerxst » 11 Feb 2007 22:48

Ok.
the timebase is still f00ked.

Should I look into some other method? will MPLayer do this?

I've been reading, it looks like this RTSP url that works in quicktime viewer actually uses Live555 protocol or some crap...

Is VLC up to this task, or not? Viewing the video looks fine, but recording it, well, it just looks like ass.

I've put the camera up for testing:
http://axis.openesque.com

i've been able to record files in VLC from the camera setting the use rtsp over tcp options in advanced settings for the demuxer, and using the URI:
rtsp://axis.openesque.com/mpeg4/media.amp

i really need to get this working, any ideas? can vlc do this? should I look elsewhere?

Thanks...
-jre
-jre

lerxst
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Jan 2007 19:18
Location: Traverse City, MI
Contact:

Since this is important

Postby lerxst » 13 Feb 2007 22:25

Since:

A) this is important
B) nobody appears to have a clue
C) I really want to be able to record streams from an axis camera...

WILL SOMEONE HELP ME IF I OFFER THEM PAYMENT.

seriously. i need to finish this project.

thanks,
-jre
-jre

Teetrinker
Cone that earned his stripes
Cone that earned his stripes
Posts: 174
Joined: 16 Aug 2004 16:12

Postby Teetrinker » 14 Feb 2007 09:06

Did you try to get some help in the vlc mailing list?
http://www.videolan.org/developers/lists.html

DJ
Cone Master
Cone Master
Posts: 8206
Joined: 01 Jan 2006 04:30
Location: Koloa, Hawaii USA

Postby DJ » 14 Feb 2007 19:36

It's not that no one has a clue. It's that you are not offering enough information regarding what you are doing. This is most often the case here.

lerxst
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Jan 2007 19:18
Location: Traverse City, MI
Contact:

more info

Postby lerxst » 15 Feb 2007 17:14

I'm not sure what /more/ information I could have offered.

The camera is online at http://axis.openesque.com and is pointed at an analogue clock with a second hand...

when i try to record rtsp://axis.openesque.com/mpeg4/media.amp i actually can, successfully, using VLC.

[ note: currently, axis.openesque.com is down -- a water main broke last night near where the T1 feeds into the shiny mysterious network box.... it should be replaced and back online later today, thursday. if you try to access it and don't get a response, until maybe 1pm EST today, that's probably why... ]

However, the played-back recording is *** way fast *** -- ie: all the frames look captured, but the speed is WAY fast... it's NOT a correctly-timebased playback of what can be correctly viewed real-time if you watch the stream live, which works fine in VLC, MPlayer, or quicktime.

I can attach endless pages of various verbosity levels, but there are really no errors that indicate why this is happening.

The only clue I can offer is that transcoding this stream while recording it, and saving it in another format with a correct timebase might solve the issue -- is this even possible?

I'm willing to budget for a solution to this, if someone comes up with a working solution, preferably command-line with no needed GUI, and it actually works...

FWIW, I have tried mplayer and my results there are the same - i have it outputting to a file "grab.mpg" that seems fine when played back, though the speed is also WAY FAST.

I have a feeling that it's due to the fact that the camera serves 25fps instead of the 29.999 we're all used to... so shouldn't VLC and MPlayer take that into account while recording to a file so that when it's played back, it doesn't look so... suck-tastic?

Thanks,
-jre
-jre

lerxst
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Jan 2007 19:18
Location: Traverse City, MI
Contact:

that's what i thought

Postby lerxst » 23 Feb 2007 16:26

provided lots of information.
offered money.
no responses.

I'm going to go buy a copy of Quicktime Pro, since this seems to be an impossibility with VLC.

Thanks all, I guess..

-jre
-jre

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 23 Feb 2007 21:30

You still have not given:
your VLC version.
you did not paste any messages.
you did not launch VLC in verbose mode.
You haven't tried to transcode with VLC To another format, or to the same changing a few things...

I still don't get if you read the stream correctly or not.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

DJ
Cone Master
Cone Master
Posts: 8206
Joined: 01 Jan 2006 04:30
Location: Koloa, Hawaii USA

Postby DJ » 23 Feb 2007 21:50

Unfortunately your links don't tell us much.

The first link:

<HTML>
<HEAD>
<META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/view/index.shtml">

<noscript>
Your browser has JavaScript turned off.<br>For the user interface to work effectively, you must enable JavaScript in your browser and reload/refresh this page.
</noscript>
</HEAD>
<BODY>
</BODY>
</HTML>

While this does open in a web page it uses QuickTime to do so.

And the second link opens Real Player for me and doesn't show the complete picture. But I can't download it to see the commands. So neither of these are helpful to giving any answers.

lerxst
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Jan 2007 19:18
Location: Traverse City, MI
Contact:

you know... just never mind...

Postby lerxst » 24 Feb 2007 05:11

you know what... never mind.

I thought I was working with some technically adept people on this forum.

Those are the URLs are this:

http://axis.openesque.com
This is the camera's address in URL format. axis.openesque.com resolves to an IP and the camera has it's built-in HTTP Server to serve to you what you see. In Safari, Firefox, IE under XP and Firefox under XP, at least for me, it loads a quicktime plugin and I'm looking at a live video feed. If you can't get it that far, which is pretty basic, you need not read further into the thread.

rtsp://axis.openesque.com/mpeg4/media.amp
Believe it or not, I'm able to open this with MPlayer, MPlayerOSX2, VLC on Windows and OSX, and it all works in view-mode just fine.
Again, if you can't get this far, you need to go learn the internet.

Again, once again, and again, what my problem is, is this:
whatever I use to record this stream records it just fine, or seems to.
The playback, under ANY viewer I've tried, is MUCH FASTER and JERKIER than the actual realtime stream.

I've theorized that it's due to a different framerate, but have been having no luck with framerate options in VLC or MPlayer or anything else for that matter.

So, that's where we're at.

Don't blame it on "Oh, your URLs look bad."

I can't do anything about that... that's what the camera serves when it's plugged in and DHCPs an address. That's fixed. That's what I have to work with. This is what needs to be dealt with. Can't change. Like taxes. YOu have to do them. HAVE to. HOW you choose to deal with them is what is up for debate. I need to figure out HOW to deal with what I have.

successful record and playback is the only goal here. skewed time is not a full success.

I don't know how much more plainly I can put it.

but whatever. it's obvious either nobody but me understands/cares/understands/cares/givesADamn/FindsItInteresting ... whatever.


so...

just never mind....


-jre
-jre

Prestwick
New Cone
New Cone
Posts: 3
Joined: 31 Mar 2007 23:39
Location: UK

Postby Prestwick » 31 Mar 2007 23:52

Oh for the love of god man! Stop being so bloody belligerent and let the men here help you!

We know its a damn webcam that you can view via a URL. Those are two a penny and I put it to you sir that you will get nowhere here if you insult the intelligence of the good people who frequent this good establishment.

The questions which are most important to you right now (whether you like it or not) sir are these:

1. Your VLC version, if you do not mind?
2. Can you paste any error messages or a log of what VLC actually does?
3. If you have no log of what happens or any error messages, can you launch VLC in verbose mode by adding -vvv at the command line (i.e. #vlc -vvv)? This will give you the ability to log and developments as you see fit.
4. Can you transcode to a different format okay in VLC?

Those four questions are what the experts here desire answers to and until then they will not be able to answer your question (no matter how rudely or offensively you put it).

If your attitude is like this every time you phone tech support at your place of work (if indeed you do have a job) then I fear for the sanity of my comrade in arms who practice the good art of systems engineering!

Please, be more polite to the people on this forum in future, they do care for your situation and want to help, but, if you insist on being so rude and stubborn then, well, what can they do but shrug their shoulders in exasperation.

I bid you good day sir! :roll:

lerxst
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Jan 2007 19:18
Location: Traverse City, MI
Contact:

ok...

Postby lerxst » 02 Apr 2007 21:51

webcam?
two a penny?
it was $795 US. it's a security cam. there's a difference.

I didn't necessarily insult anyone, just expressed my frustrations that nobody seemed to read what i typed, including yourself.

Here are the answers to your "questions", and whether i like it or not is beside the point.

1) OS X: 0.8.6a, Win2k: 0.8.6a
2) I could have before, but I abandoned VLC for now and am not at a point where I can easily work with the 200meg file and post the logs for it. They really do get quite lengthy, and I didn't want to do this without someone requesting me to do it. (clutter)
3) I can, and have been doing this to troubleshoot.
4) Yes, but the results are just as horrible as when playing the mpeg-4 file initially. It's something with the demux, I'm fairly sure.

my attitude is only like this when people piss me off. you haven't, you're just irritating me. Your personal attacks toward me in the area of employment (though subtle and indirect) broke your own post out of the "technical" realm and into that of "flames". judgemental, are we?

I fear for your comrade as well, since "systems engineering" sounds pretty generic. I think that's what we called the help-desk phone operators at a job i had years ago.

hm. asking me to be polite to people after insults. ... do as i say not as i do.

Very well.

I apologize if my past "disgust" and "exhaustion" on this topic (and yes, one could read that there may have been other elements in my life aside from this forum contributing to my stress.. ) ruffled anyones feathers and bled into the areas of being insulting. you have my apologies, such lashes were uncalled for.

I just get "heated" when people ask questions that could have been answered before asked by scrolling up and reading what's already on the screen..

no emoticon for you-

-jre
-jre

DJ
Cone Master
Cone Master
Posts: 8206
Joined: 01 Jan 2006 04:30
Location: Koloa, Hawaii USA

Postby DJ » 02 Apr 2007 22:05

Anger + frustration + ignorance and lack of correct information = no answer here and leads to insults and more frustration which eventually leaves you selecting another program to do the job. 8) Then you can repeat the process with someone or something else! :lol:

JoeShmo
New Cone
New Cone
Posts: 7
Joined: 07 Apr 2007 15:37
Location: New York

Axis recording...

Postby JoeShmo » 15 Apr 2007 06:46

In case people are looking for answers, and read this thread (along with all the others about trying to record from an axis camera), heres a few things I've discovered:

1) Buying quicktime pro is useless, it just saves a pointer to the live stream, but doesnt record it, very annoying, and a waste of $30.

2) Don't bother with Axis Video Capture, or Axis Camera Station, as they won't give the audio once exported out of ACS.

3) Apparently, there is a flaw in most of axis's rtsp servers on their cams. Its fixed in the 4.4 firmware (of the 210 at least) but I dont think they applied it to all their cams.. for example, the 214 (which is what I have) still does not work.

4) the rtsp server in the cam, I believe is (or is based on) mpeg4ip, and seems broken with reguard to timestamps and such.. for some reason, VLC does not sync properly with it. If you keep trying, then out of 100 tries, you may get an actual recording to work.

5) I would *LOVE* for the coder who knows alot about the live555 module/demuxer to write a special subroutine to deal with the silly axis camera flaws. My camera will change IPs on Monday, so I wont bother posting the IP here, but I'll be on the IRC channel for a bit until I (or someone) can get this silly thing to save a recording, as it is imperative that the stream gets recorded for a meeting on tuesday. I've been trying to record this (audio AND video) for the past 3 weeks. The best I can come up with so far is a screen capture utility, and somehow looping line out back into mic in.

I've tried vlc 0.7.2, 0.8.5, 0.8.6a, 0.8.6b-test1, and April 12th's 0.9.0 build for windows xp on 4 different machines.
I've also tried 0.8.6a and April 10-13's svn 0.9.0 on 3 Debian boxes. Trying to output on all the file container/codecs output I can think of.

Heres a few of the errors I get:
[00000298] ffmpeg encoder warning: almost fed libavcodec with a frame in the past (current: 271732136181, last: 426016821247)
[00000298] ffmpeg encoder warning: almost fed libavcodec with a frame in the past (current: 271732169547, last: 426016821247)

[00000560] live555 demuxer debug: npt 2435786
[00000560] live555 demuxer debug: pts: 435286

before mentioning udp caching, take a look at the 271732169547 and 426016821247. If those two stamps are that far off, then a few seconds of udp caching isnt going to help much, if I'm reading those mtime_t values correctly, we're talking about a few years, no?

heres a few commandlines I've been using:

Code: Select all

vlc -vvv --color -I dummy rtsp://136.224.62.163/mpeg4/media.amp --rtsp-caching=2000 --sout="#transcode{vcodec=DIV3,vb=1024,scale=1,acodec=mp3,ab=128,channels=1}:std{access=file,mux=asf,dst=/root/test.asf}" vlc -vvv --color -I dummy rtsp://136.224.62.163/mpeg4/media.amp --rtsp-caching=4000 --sout="#transcode{vcodec=DIV3,vb=1024,scale=1,acodec=mp3,ab=128,channels=1}:std{access=file,mux=asf,dst=c:\files\axis\blah.asf}" vlc -vvv --color -I dummy rtsp://136.224.62.163/mpeg4/media.amp --rtsp-caching=4000 --sout=#duplicate{dst=std{access=file,mux=asf,dst="c:\files\axis\test.asf"}}
Much like the origional poster, I'm very frustrated... But I'm still trying to "keep my cool".

DJ
Cone Master
Cone Master
Posts: 8206
Joined: 01 Jan 2006 04:30
Location: Koloa, Hawaii USA

Postby DJ » 15 Apr 2007 07:19

If you are getting those errors during play back it is very doubtful transcoding will yield a usable file.

It seems the original poster here couldn't get the cam to work with its own software. Is this also true in your case? If this is true I would return the cam and get my money back.

JoeShmo
New Cone
New Cone
Posts: 7
Joined: 07 Apr 2007 15:37
Location: New York

cam software..

Postby JoeShmo » 15 Apr 2007 07:39

It does indeed work with its own software - a webpage.

As for the "Axis Camera Station" it does indeed work with that, and the recordings from ACS do have audio and video, but they are in some format I am unable to figure out (mplayer and vlc cant tell what they are either), but they can be "saved". It just so happens that this "feature" allows for saving of the video and not both the a/v, as this app is meant more for security cameras, which typically, audio isnt needed.

The Windows Capture Driver is just a device driver to see the video feed, as thats how most capture cards work, just video capture, and its up to your sound card to do the audio.

it also plays back from quicktime, using the rtsp url.

I was getting all those errors when trying to record/transcode, not while playing... When I'm playing it now, the first 30 seconds, its choppy (both audio/video), and audio is starving, etc.. then it starts to get better, and by about 50 seconds, the stream seems fine... same with a recording now. after I started messing around with crazy rtp-late values:

Code: Select all

vlc -vvv --color -I dummy rtsp://136.224.62.163/mpeg4/media.amp --rtp-late=9999999999 --udp-caching=3000 --rtsp-caching=2000 --sout="#transcode{vcodec=DIV3,vb=1024,scale=1,acodec=mp3,ab=128,channels=1}:std{access=file,mux=asf,dst=c:\files\axis\blah.asf}"
I also have to try to play or transcode about 10-15 times before it actually works (as in, other times, it does the 10s timeout, and no stream came in). I'm trying to do things from home at the moment, which I think is the problem for the timeout, whereas normally, all this will be done from work (where I have done most of the testing in the past with this project).

For thest latest tests, I'm on my XP/VLC 0.8.6a system.

DJ
Cone Master
Cone Master
Posts: 8206
Joined: 01 Jan 2006 04:30
Location: Koloa, Hawaii USA

Postby DJ » 15 Apr 2007 07:50

You should probably move on to VLC 0.8.6b as the tests have begun.

The source formats can be gained by pressing ctrl i and go to the advanced Info... tab. Post that here.

JoeShmo
New Cone
New Cone
Posts: 7
Joined: 07 Apr 2007 15:37
Location: New York

a/v formats from an axis 214 camera.

Postby JoeShmo » 15 Apr 2007 08:03

Stream 0
Codec: mp4v
Language:
Type: Video
Stream 1
Codec: ulaw
Language:
Type: Audio
Channels: 1
Sample rate: 8000 Hz

and if anyone wants a second opinion, this is how ffmpeg sees it:
Stream #0.0: Video: mpeg4, yuv420p, 352x240, 100.00 fps(r)
Stream #0.1: Audio: pcm_mulaw, 8000 Hz, mono, 64 kb/s

(the cam does better than 352x240, I reduced it on the camera to lighten the load a little on the encoders, and the live stream).

JoeShmo
New Cone
New Cone
Posts: 7
Joined: 07 Apr 2007 15:37
Location: New York

doesnt work in 0.8.6.b either...

Postby JoeShmo » 15 Apr 2007 19:29

No surprise, but it doesnt work in 0.8.6b either.. maybe one in 20+ attempts, I can get a recording that has both audio and video, and can be played back in vlc. If I stick that recording on a web server, and tell vlc to play it via http, it doesnt work. If I try to re-encode that recording with ffmpeg, it does not work either, giving alot of invalid new backstep errors.

Sorry I can't give much in the way of error messages, as there are different errors each time.. So it must be "experienced" by someone who can decypher the errors that do come up.

JoeShmo
New Cone
New Cone
Posts: 7
Joined: 07 Apr 2007 15:37
Location: New York

saving rtsp mpeg4 stream from axis camera..

Postby JoeShmo » 16 Apr 2007 03:36

looks like mencoder can do it...

Code: Select all

mencoder rtsp://axis-ip/mpeg4/media.amp -oac mp3lame -ovc xvid -ffourcc XVID -lameopts vbr=3:abr:cbr=50:aq=9:mode=3 -xvidencopts bitrate=512 -vf scale=320:240 -fps 20 -o ~/axisvideo.avi
I'm not real good with the lame options, or the video options, but at least this came up with a working file which can be converted to most anything else.. got alot of buffer underlows that I'm still trying to figure out, but this is the furthest I've gotten so far...

DJ
Cone Master
Cone Master
Posts: 8206
Joined: 01 Jan 2006 04:30
Location: Koloa, Hawaii USA

Postby DJ » 16 Apr 2007 06:16

Given what you have told me thus far I'm not quite sure I can be helpful on this one. You are doing what I would do given the source format.

It almost sounds like a bad switch in one of the hops to the source, but you say there are no errors until the playback of the saved file.

What happens if you change the video encode format to nothing and the audio to AAC and the container to MP4? This would be a copy video and transcode audio in another container. Assuming it plays in VLC, try to play it in Quick Time. This method also may give you a clue as to what the real bitrate is.

You could also try MP4v with AAC in a MP4 container.

Your method should make a compatible WMP file where it would use Microsoft's MPEG42 or 43 depending on you using WMP 10 or 11. If the file must be compatible with WMP, try WMv2 with MP3 in a WMV container. We are told this works now, but you will need to make the change to the command line for the container (from asf to wmv) and name the file something.wmv. Of coarse WMv2 and MP3 should also work in a ASF container.

Let me know if any of these make it better or worse.

If you want to try something similar to memcoder in VLC there are several errors on your command line.

1. It's fps=<framerate> which may or may not be required in this case. Personally I wouldn't think it would be needed.

2. VLC does not have an working AVI container so your naming convention must be something.asf as these containers are different.

3. Scale is a percentage of the original or scale=.25 for example. But I don't think this is necessary either, given what you have said about the source.

Scale and fps will only work in a transcode of the video and not do anything if you a just copying it.

--sout-transcode-scale <float>
Video scaling
Scale factor to apply to the video while
transcoding (eg: 0.25)
--sout-transcode-fps <float>
Video frame-rate
Target output frame rate for the video stream.

lerxst
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Jan 2007 19:18
Location: Traverse City, MI
Contact:

followups

Postby lerxst » 23 Apr 2007 22:52

i appreciate all of your comments on my demeanor and criticism of my actions in using mplayer;

I would like to confirm JoeShmo's observations in that:
-QuickTime Pro is a waste of time and money (and should be free. Please, apple, give it up...)
-Axis Camera Suite was a memory and system hog, and records to proprietary files with seperate timecode formats, which ended up being useless to VLC (and other players) without lots of post-processing. Since I'm dealing with a realtime solution, sorry, this is too much overhead.
-live555 demux has a few inabilities to deal with the Axis implementation of rtsp correctly - but according to their documentation and API (we're a developer partner with Axis now) it is not an 'incorrect' or 'broken' implementation, just one that the tools in VLC are unable to deal with.
-i've actually met with much success using ffmpeg and mplayer, as well as getting MUCH better results with M-JPEG and mjpeg-tools.

In short, VLC is not currently set up to deal with the implementation of mpeg-4 that the Axis cameras serve up, which is, contrary to popular opinion, not "broken". So, we've moved on to other software not out of "disgust" or whatever, but because this project had deadlines that needed to be met (which is why i offered payment for a solution) and we ended up just doing a lot of research, discovering that fixing this broken tool was less trivial than learning a somewhat-working new tool and improving upon it. Though if it makes you all feel any better, you can believe whatever you wish. :)

We had "decent" results, in the end, with Axis 210A and Axis 221 cameras in mpeg-4, but when project requirements shifted slightly, we actually decided to go M-JPEG due to faster on-the-fly frame-based editing. ... and it's working great. :)

Oh... the real reason we started looking beyond VLC:

- despite a lot of documentation on command-line switches (which by the way, when viewed on the wiki, kills EVERY firefox browser on EVERY machine i tried to view it with... but not IE.. very odd. anyone else notice this when looking at the expanded command-line wiki page?) we were completely unable to get VLC to run without popping something onto a GUI. Since our end-solution needed to run "headless in a terminal", this was a must-have. when I spent hours determining that a) there is either no information on how to run without a GUI or b) there is no way to do it, we moved on to other solutions.

the only use I have for a GUI is so it can hold more terminal windows. :)

-jre
-jre


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 18 guests