[Live-devel] openRTSP saving to a microSD card

Roberts, Alan Alan.Roberts at e2v.com
Wed Mar 4 02:02:14 PST 2009


Hi. A brain-teaser for your coffee break... (but I don't know the solution!)...

I'm using openRTSP to read incoming streaming mpeg4 video over ethernet and store it on a micro SD card. The aim is to then download the mp4 file(s) over the USB port onto a host pc for subsequent viewing. The input video stream comes from our thermal imaging camera: 320x240 at 10fps. The Linux target is an ARM-based 3rd party embedded card with ethernet, SD card and USB connections.

It's "so nearly" working! I can successfully record video onto the micro SD card and play it back reliably... which proves it's all possible. The devil is in the detail though...

Once I've started openRTSP running in the background from the command line it seems to be that: 

IF (the recording is => 2 minutes long) then it is successfully saved onto the micro SD card... I can turn off the camera straight after stopping the recording and "all is well" when I come to play back the file over USB
ELSE a short recording (< 2 minutes) is only successfully saved onto the micro SD card if I wait about 2 minutes from starting the recording to subsequently stopping it and turning off the camera.
 
The only code I've written is a short bit of C that establishes if the record button has been pressed, a bit of filename control and ethernet link checking. Oh, and the following command line that gets run if (and only if) the record button has been pressed and the ethernet is up and running (established by a successful "ping"):

strcpy(start_command_str,"\n");
strcat(start_command_str, "./openRTSP -V -b 50000 -4 -w 320 -h 240 -f 10 rtsp://10.133.1.20:554/tic04 >  ");
strcat(start_command_str, "/mnt/uSDcard/");
strcat(start_command_str, new_filename);
strcat(start_command_str," &\n");
system(start_command);

On further investigation it appears that the micro SD card is "somehow" put into read only mode for about 2 minutes from the point at which I invoke openRSTP. I can't even write to a text file on the micro SD card during that magic 2 minute period.

Saying that though, in order to be able to stop the recording session I redirect the output of "ps" to a text file (after about 1 second) and use fscanf to find the Process ID of the existing openRTSP process from this file. So, creating this file within the 2 minutes worked but I can't seem to write to any others. I fopen it as readonly and fclose it once I've found the Process ID (pid_str). Confusing.

Once the record button has been pressed to stop recording (it's polled many times a second) I issue the following :

strcpy(stop_command_str,"kill -HUP ");
strcat(stop_command_str, pid_str);
strcat(stop_command_str, " \n");
system(stop_command_str);

This all seems to work fine. It's the "2 minute thing" that's getting me. I haven't got the luxury of making software changes on the camera. I'd really appreciate any help you may be able to offer and I'm more than happy to provide more details on the implementation, background, output logs etc. I'm not and expert in C or Linux - but I'm not usually defeated.

Many thanks and I look forward to hearing from you soon.

Alan



Sent by E2V TECHNOLOGIES PLC or a member of the E2V group of companies. 
A company registered in England and Wales. 
Company number; 04439718. 
Registered address; 106 Waterhouse Lane, Chelmsford, Essex, CM1 2QU, UK.

______________________________________________________
________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20090304/a76dc8ed/attachment.html>


More information about the live-devel mailing list