Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Zyzel NSA310/NSA325 NAS Box recording a Foscam IP Stream

  • 20-03-2014 9:49pm
    #1
    Closed Accounts Posts: 8,015 ✭✭✭


    Hi,

    on a bargain alert I mentioned this could be done and another poster asked for a "mini tutorial" on it.

    Rather than polluting the bargain alerts thread with seriously technical details I'll start a thread here, so people can reply/respond to it.

    In summary, you install FFMPEG and it can record both local USB webcam streams AND streams from a wireless IP camera you might have.

    Okay, so you need a Zyzel NAS box.
    I've a Zyzel NSA325, which is the dual bay version of the Zyzel NSA310 which has an extensive thread on bargain alerts in it's own right.

    I've a FOSCAM FI8918W IP camera, but I imagine other cheap chinese pan and tilt clones will work too.


    1. Install FFP, a nice collection of extra packages for the Zyzel NSA310/NSA325 family of NAS boxes.
    See http://zyxel.nas-central.org/wiki/FFP-stick#NSA-320.2C_NSA-325.2C_NSA-325v2.2C_NSA310S.2C_NSA320S.2C_TDC_Homebox.2C_on_FFP-Stick_version_2012-03-19_or_newer

    2. Install a utility that updates the list of sites you can then download extra packages & utilities from.
    Link : http://nas-tweaks.net/373/uwsiteloader-tool-to-download-the-sites-definitions-for-packages-of-the-fun_plug-0-7/

    3. Login via telnet to your NAS box and run "slacker -i" to install the FFMPEG packages, in my case in installed the following

    br2:ffmpeg2/fdk-aac-0.1.2-arm-0.txz
    br2:ffmpeg2/ffmpeg-2.1.3_git20140213-arm-0.txz
    br2:ffmpeg2/fontconfig-2.10.95_git20130907-arm-0.tzy
    br2:ffmpeg2/freetype-2.5.0.1-arm-0.txz
    br2:ffmpeg2/fribidi-0.19.5-arm-0.txz
    br2:ffmpeg2/lame-3.99.5-arm-0.txz
    br2:ffmpeg2/libass-0.10.1.-arm-0.txz
    br2:ffmpeg2/opus-1.0.3-arm-0.txz
    br2:ffmpeg2/rtmpdump-2.4_git20130907-arm-0.txz
    br2:ffmpeg2/shine-3.0.0-arm-0.txz
    br2:ffmpeg2/twolame-0.3.13-arm-0.txz
    br2:gettext-0.18.3.arm-0.txz
    br2:libiconv-1.14-arm-0.txz
    


    4. Then I wrote a Linux script to execute FFMPEG in the background.

    Below you'll want to change the destination folder, your FOSCAM IP address, username and password to access your IP camera.
    export PATH=/ffp/sbin:/usr/sbin:/sbin:/ffp/bin:/usr/bin:/bin
    NOW=$(date +"%Y-%m-%d-%H%M")
    # Change the directory below to the directory you want to record to on your NAS
    
    DESTDIR=/i-data/028894c9/FOSCAM/video
    
    echo "Capturing $1 : $DESTDIR/test_${NOW}.avi"
    
    nohup ffmpeg -r 1 -i "http://192.168.1.21/videostream.asf?user=YOUR_WEBCAMUSERNAME&pwd=YOUR_WEBCAM_PASSWORD&resolution=32&rate=15" -t $1 -vcodec mpeg4 -an -y -vf drawtext="fontfile='$DESTDIR/cour.ttf':expansion=strftime:text=%{localtime:%d/%m/%Y %H\\\\:%M.%S: x=2: y=2: fontcolor=white: box=1: boxcolor=black" $DESTDIR/test_${NOW}.avi > /dev/null 2> /dev/null < /dev/null &
    


    I used mpeg4 as the codec as it didn't max out the CPU.
    I did use X264 too, but it did max out the CPU and when I gave a time limit of eg. 6 hours it was accurate using mpeg4, but X264 overran badly as it tried to catch up on frames, eg. it ran for 9 hours instead of 6.

    Usage:

    Save the above Linux script as recordTimelapse.sh.
    Give it execute permissions, eg. chmod a+x recordTimelapse.sh

    To record 1 hour, capturing 1 frame per second run

    recordTimeLapse "01:00:00"

    To record 12 hours, capturing 1 frame per second run

    recordTimeLapse "12:00:00"

    I have an Android app "ServerAssistant" on my smart phone allowing me to define and execute pre-defined Unix commands, so I have "record for 1 hour", "record for 12 hours" etc defined on it.

    Oh yeah, I needed to grab a true type font file from Windows eg. cour.ttf and put it in the destination folder too.

    So the tricky part is installing the extra packages for ffmpeg.

    regards,
    CD


Comments

  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    Think I left out the main package for ffmpeg !
    So you need to install it via the "slacker" utility as above ( updated list above now )
    br2:ffmpeg2/ffmpeg-2.1.3_git20140213-arm-0.txz
    


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    The bottom two packages on your list aren't displaying for me, any idea how to source them?

    br2:gettext-0.18.3.arm-0.txz
    br2:libiconv-1.14-arm-0.txz

    Also, how do I add the path to the script so that I can excecute it from the NAS?

    I keep getting command not found.

    Thanks for the great work on the Tut!


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    Hi,

    you may or may not need the br2:libiconv-1.14-arm-0.txz.
    The br2:gettext-0.18.3.arm-0.txz I think may only be required if you want to draw a security timestamp on each frame.

    Can you run ffmpeg on the command line now without error ?
    If so, you're a good ways there.

    I downloaded and ran the "usiteloader.sh" utility in one of my links.
    This gave me the option of selecting various sites I could download extra packages from. You might as well select all the sites ( 8 on my machine ) that they offer you.

    Then when you ran the "slacker" utility, you get more selections to download.

    If you just want to test ffmpeg on an active webcam there's incremental steps you can take to test it.

    FFMPEG webcam capture page

    So a usb webcam would probably be something like
    ffmpeg -f v4l2 -r 25 -s 640x480 -i /dev/video0 out.avi
    

    If you've an IP camera, then you typically need to know the URL of the video feed, and the cameras username and password if required.

    For Foscam cameras that's in the format of
    http://YOUR_WEBCAM_IP/videostream.asf?user=YOUR_USERNAME&pwd=YOUR_PASSWORD
    

    If you've a Foscam clone, then it might be a different URL format.
    You can try them directly in a browser URL to see if it works first.

    When you got it right, then you can run something like the following..
    ffmpeg -r 1 -i "http://YOUR_WEBCAM_IP/videostream.asf?user=YOUR_USERNAME&pwd=YOUR_PASSWORD" -t "0:01:00" -vcodec mpeg4 -an -y test.avi
    

    That'll try to capture the video for 1 minute.
    I explicitly didn't want to store audio, so the "-an" in the command line does that. If you leave out the "-an" bit, you'll record audio too.

    If you get it working on the command line like that, then you can alter my linux script accordingly.
    You need the "nohup" and redirection of standard input/output if you want to run a recording in the background but logout.
    Otherwise your timelapse recording will end abruptly as soon as you logout of your telnet session.

    regards,
    CD


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    Thanks for the detailed response, really appreciate the time it has taken you to do that!

    I'm still stuck at 'command not found' stage on the command line

    I can't for the life of me find the profile file or whatever the equivalent on the NSA310 is that stores the paths to see if I can add it there.


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    It's been a while since I installed it, but I thought I just needed to use the "slacker" utility to install the new packages, eg. anything that had "ffmpeg2" in the name.

    When I run "which ffmpeg" (tells you what path it found it at), it says "/ffp/bin/ffmpeg" for me.

    When I run "export $PATH" to see what my system path is, I have
    /ffp/opt/java/jre/bin:/ffp/bin:/usr/bin:/bin
    


  • Advertisement
  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    iPhone. wrote: »
    I can't for the life of me find the profile file or whatever the equivalent on the NSA310 is that stores the paths to see if I can add it there.

    Looks like FFP adds a profile file.

    I've some form of a bash profile file in /ffp/etc/profile


  • Registered Users, Registered Users 2 Posts: 2,320 ✭✭✭Chet T16


    Trying to get this setup with my NSA310 and y-cam.

    Probably a stupid question but where should i save the recordTimelapse.sh file?


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    Chet T16 wrote: »
    Trying to get this setup with my NSA310 and y-cam.

    Probably a stupid question but where should i save the recordTimelapse.sh file?

    No worries, it's not a stupid question, it's tricky to know where to store it.

    If you telnet/ssh in to your NAS box and run "df -h" it will show you the file systems mounted on the NAS box.

    My 3TB hard drive is mounted as /i-data/028894c9

    So I created a folder called FOSCAM there, off the root directory.
    I stored it there.


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    OK I can see the live footage in my browser by going to

    http://YOUR_WEBCAM_IP/videostream.asf?user=YOUR_USERNAME&pwd=YOUR_PASSWORD

    but when I run

    recordTimeLapse.sh "00:01:00"

    I get

    Capturing 00:01:00 followed by the path addy but the file never shows up.

    Any ideas on where it's sending it?


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    Seems like I'm in business, finally got it sorted, just need to tweak it now hopefully!

    I'm getting the time stamp showing at the start of the recorded video clip but it fades out after a few seconds, any pointers on how you got it to display constantly for each frame as it plays? - Definitely a case of not seeing the wood for the trees! - I just noticed now that the time stamp is actually displayed in the top left very inconspicuously and it does indeed display constantly for each frame, I was looking at the initial file name that VLC displays by default for about five seconds which in this case just happens to contain the time stamp as part of the name, threw me a bit!

    Delighted to have gotten this far, I always thought it was a glaring omission on Zyels part not having it as part of the onboard package selection like other NAS manufacturers do.

    Chuffed with this, thanks again for the great explanation and the time you took to post it, I reckon lots of people will find it useful as there aren't many 'real life' how to's on this particular NAS.


  • Advertisement
  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    iPhone. wrote: »
    Chuffed with this, thanks again for the great explanation and the time you took to post it, I reckon lots of people will find it useful as there aren't many 'real life' how to's on this particular NAS.

    Excellent, delighted it works for you !
    It's been a while since I had set up FFP/slacker packages so I was worried I might've missed something.


    Due to my script using "nohup" and redirecting standard input/output to null, it does hide any error messages you get.

    So for anyone else, I'd recommend getting it working on the command line first before moving to the shell script.
    iPhone. wrote: »
    Delighted to have gotten this far, I always thought it was a glaring omission on Zyels part not having it as part of the onboard package selection like other NAS manufacturers do.

    Yeah, although that could open a can of worms for them support wise, eg. webcams which aren't supported by Linux, and having to know and include the codecs for all IP cameras.

    I did read up about how to create your own Zyzel packages but not sure I'd have the time/enthusiam to do this!

    cheers,
    CD


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    Due to my script using "nohup" and redirecting standard input/output to null, it does hide any error messages you get.

    So for anyone else, I'd recommend getting it working on the command line first before moving to the shell script.

    That's what I did myself, makes it easier to get the feedback on the initial command line alright.

    One tip for anyone else trying it is - when you are using your web browser at the start to confirm you have a live stream to grab etc - don't for the love of God use Chrome as your browser!! I wasted an entire hour or more trying to get it to display as Chrome is my default browser, just had a thought and switched to Firefox and the damned video stream appeared instantly!!:mad:

    Another tip, I use windows more than Linux and found using Filezilla to ssh into the NAS was a great way of updating the recordTimeLapse.sh file every time you tweaked it as it also allows you to change the permissions back to 777 straight from windows.
    I did read up about how to create your own Zyzel packages but not sure I'd have the time/enthusiam to do this!

    It would be a nice hobby once you didn't get caught up in the frustration of it I'd imagine, but somehow I think it would slowly take over your life ;)


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    Forgot to ask you about the android app 'ServerAssistant' - I cant see that at all in the google store, is there any alternative that you know of to achieve the same? It would be very handy to just be able to issue the command from mobile for the various time lengths.

    I know it's linux, but wonder if there is possibly an iPhone app capable of doing the same too?


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    iPhone. wrote: »
    Forgot to ask you about the android app 'ServerAssistant'

    Here's the direct link to the Android playstore.

    ServerAssistant Playstore link
    iPhone. wrote: »
    I know it's linux, but wonder if there is possibly an iPhone app capable of doing the same too?

    I don't have an iPhone, but you'll probably want to search the Apple store for something like "remote unix shell client" or "telnet client".

    iPhone. wrote: »
    It would be a nice hobby once you didn't get caught up in the frustration of it I'd imagine, but somehow I think it would slowly take over your life ;)

    Actually it looks like it "might" be easy Creating FFP packages

    Maybe just tar up the directory which contains the ffmpeg2 binaries, as a .tgz archive.
    Then others can install it as "funpkg -i ffmpeg_for_zyzelnas.tgz"


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    I just recorded an hour of footage and checked the timestamp, it isn't correct, I started the hour recording at 11 and the final frame time stamp is for 11.32, seems to be running approximately 50% behind with the time stamp even though it does record for the full 60 minutes.

    Does yours do the same or is there something I'm missing to regularize this?


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    For my Foscam FI8918W, I can specify an optional parameter in the URL to define the frame rate I want the camera to serve.

    rate=15 is 1 frame per second
    ffmpeg -r 1 -i "http://192.168.1.21/videostream.asf?user=YOUR_WEBCAMUSERNAME&pwd=YOUR_WEBCAM_PASSWORD&resolution=32&rate=15"
    

    I don't know what your specific camera model is, or whether it can take a frame rate parameter.

    Also, have you got your NAS doing anything else in the background?
    Media server, torrenting etc ?


  • Registered Users, Registered Users 2 Posts: 2,320 ✭✭✭Chet T16


    I'm heading in the right direction now and seem to have the correct URL for my y-am figured out but when i try run from the command line i get a "protocol not found" error which seems to be caused by the USER:PASSWORD@http://... format of my url as when i allow anonymous access to the camera i can record using the url on its own.

    Also i noticed that although it was set for 1fps for 1 minute it seemed to be reading at the cameras up date rate then stretching them out over 60 seconds but this may be because the camera is running at its default 15fps so that can be fixed


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    Chet T16 wrote: »
    "protocol not found" error which seems to be caused by the USER:PASSWORD@http://... format of my url

    I done a quick search for "Y-Cam" and URL and found a handy page here

    So your URL format also seems to be
    http://IPADDRESS/videostream.asf?user=[USERNAME]&pwd=[PASSWORD]&resolution=64&rate=0
    

    BUT... I'm not sure of the resolution and rate correspond to the same as on my FosCam.

    The FosCam values for rate translate to...
    0 : full speed
    1 : 20 fps
    3 : 15 fps
    6 : 10 fps
    11: 5 fps
    12 : 4 fps
    13: 3 fps
    14: 2 fps
    15: 1 fps
    17: 1 frame per 2 seconds
    19: 1 frame per 3 seconds
    21 : 1 frame per 4 seconds
    23: 1 frame per 5 seconds

    The resolution value translates to
    8 : 320 x 240
    32 : 640 x 480
    \\


  • Registered Users, Registered Users 2 Posts: 2 bkdg100


    how many frames are you guys capturing per sec, and how much cpu is used ? thanks in advance.


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    I explicitly only wanted 1 frame per second, for a poor mans security camera, also to limit the file sizes.

    I can't remember offhand how much of the CPU was used.
    I'd have to check when I get home, but I used MPEG4 compression.
    X264 compression would be more CPU intensive.

    If file size wasn't a problem, there's probably other simpler/faster video codecs that might not use the CPU as much.

    I imagine if you used the same codec that the camera produces, there would be no transcoding required at all, eg. mine produces an MPEG video stream. I was more biased towards smaller video file sizes with codec compression than CPU usage.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    Actually it looks like it "might" be easy Creating FFP packages

    Maybe just tar up the directory which contains the ffmpeg2 binaries, as a .tgz archive.
    Then others can install it as "funpkg -i ffmpeg_for_zyzelnas.tgz"

    Came across this today - might be of interest to you.

    LINK


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    bkdg100 wrote: »
    how many frames are you guys capturing per sec, and how much cpu is used ? thanks in advance.

    I've set mine like creepingdeaths at 1 Frame per second but my cpu is pelting along at 100% but that's not caused by the ffmpeg install, it seems to be the ffp package in general, have to get to the bottom of it myself.


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    Yeah, 100% isn't right.

    I've just tested mine, running the "top" command in telnet.

    ffmpeg is coasting along nicely at between 11-14% of CPU.

    I've posted my results so you can see which process might be taking up more CPU time.
    top - 16:17:30 up 11 min,  1 user,  load average: 0.06, 0.44, 0.40
    Tasks:  90 total,   1 running,  89 sleeping,   0 stopped,   0 zombie
    Cpu(s): 12.6%us,  1.7%sy,  1.0%ni, 84.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Mem:    509844k total,   503000k used,     6844k free,   135888k buffers
    Swap:  1038320k total,        0k used,  1038320k free,   203016k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
     5324 root      20   0 35700  11m 3504 S 12.6  2.4   0:24.86 ffmpeg
     5265 root      20   0  1256  608  440 R  0.3  0.1   0:00.79 top
        3 root      15  -5     0    0    0 S  0.0  0.0   0:00.01 ksoftirqd/0
        4 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 events/0
        1 root      20   0  2724  528  456 S  0.0  0.1   0:29.19 init
        2 root      15  -5     0    0    0 S  0.0  0.0   0:00.01 kthreadd
      119 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 kblockd/0
      124 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 scsi_zyxeljob_w
        5 root      15  -5     0    0    0 S  0.0  0.0   0:00.01 khelper
        8 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 async/mgr
      157 root      20   0     0    0    0 S  0.0  0.0   0:00.00 crypto
      158 root      20   0     0    0    0 S  0.0  0.0   0:00.00 crypto_ret
      161 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 button controll
      169 root      20   0     0    0    0 S  0.0  0.0   0:00.00 pdflush
      170 root      20   0     0    0    0 S  0.0  0.0   0:00.12 pdflush
      171 root      15  -5     0    0    0 S  0.0  0.0   0:00.48 kswapd0
      172 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 aio/0
      173 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 nfsiod
      174 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 cifsoplockd
      176 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 xfs_mru_cache
      177 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 xfslogd/0
      178 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 xfsdatad/0
      179 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 xfsconvertd/0
      180 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 crypto/0
      850 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_0
      851 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_1
      865 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 sata2rbm/0
    

    FYI: I installed FFP permanently on a USB key on the NSA325.

    If your webcam isn't recognising the frame rate parameter or not interpreting it as 1 FPS, then ffmpeg may be trying to encode 30fps or the like, which would explain the extra cpu.

    If you can record a video for a fixed length of time, then use some video utility to check how many frames have been recorded you could confirm/rule out that theory.


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    I deleted a clutch of packages from ffp on mine, just pruned down on a best guess way what mightn't be needed. Of course I deleted a file that was needed and ended up with this error

    /ffp/bin/funpkg: can't load library 'libexpat.so.1'

    This left me unable to install or uninstall anything. Fortunately I was able to download the expat package and extracted the contents of the lib folder on a linux machine (tried on windows first but that breaks the symlink) and then copied them back in to the ffp via ssh, was then able to use slacker -a expat to update it.

    Seems to have done the trick, cpu not running at a constant 100% anymore, ffmpeg running around 6-8% when recording.


  • Registered Users, Registered Users 2 Posts: 2 bkdg100


    iPhone. wrote: »
    Came across this today - might be of interest to you.

    LINK

    the wording throws you a bit , so let me make it simple . download the file

    This file "web_prefix" and put in \\NAS***\admin\zy-pkgs\

    continue to follow directions...

    great find ..


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    Where is recordTimeLapse.sh pulling the time from? Windows, my system and the ip Cam time are correct but the recordings are displaying a timestamp one hour in arrears since the daylight savings came in this morning.


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    Yeah, I see a similar issue on my environment, even with the correct timestamp and auto-daylight savings enables in the NSA325 administration web interface.

    When I telnet in and run "date" it shows it as UTC, not localtime.

    The drawtext filter on the ffmpeg command line of my recordTimeLapse.sh shell script is where the date comes from.
    Although I see the "strftime" function in it is supposed to be deprecated.

    I tried a number of different things, including setting some environment variables which are supposed to dictate the locale, eg. "TZ=Europe/Dublin" but it didn't have any effect.

    I also tried a couple of different parameters for the drawtext filter (which draws the timestamp on each frame ).
    No joy yet.

    A dirty workaround might be to set your timezone to GMT, disable daylight savings hour and manually increment the hour by 1...
    So you would have to manually control the daylight saving time yourself.

    But I haven't had time to fully look into this.


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    Okay, after a lot of googling I find the solution.

    So the /etc/localtime file is a symbolic link to the /etc/MyZone file on the NSA325.

    Typically it's a direct link to one of the timezone files.
    If you look in /usr/local/zoneinfo there's a load of timezone files.

    Quick solution is to make a backup of your original MyZone file in case you need to restore it, and copy the Europe/Dublin file over it.

    So the following 2 commands should do that for you
    cp /etc/MyZone /etc/MyZone_BACKUP
    cp /usr/local/zoneinfo/Europe/Dublin /etc/MyZone
    

    You must be logged in as "root" for this.

    You can confirm it worked by running "date" on the command line.
    Before the fix, it showed UTC time, now it shows IST.
    Confirmed working with ffmpeg too.

    I haven't tested whether the fix will survive a reboot or not.

    regards,
    CD


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    So the following 2 commands should do that for you
    cp /etc/MyZone /etc/MyZone_BACKUP
    cp /usr/local/zoneinfo/Europe/Dublin /etc/MyZone
    
    Tried it and it works alright but doesn't survive a reboot.


  • Advertisement
  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    Okay, some script must be overwriting it.
    I'll have a look tonight, but so far I've found this web page on FFP, and under the "Basic Configuration" heading is mentions the FFP start up scripts.

    I'd be looking around there first, and maybe adding the above fix if needed, or ideally removing places where they overwrite it, so any change remains intact regardless.
    Basic configuration

    During startup, various scripts are run that you can enable, disable, and modify to your needs.

    Scripts to start, stop, and restart various network servers and a few other functions are stored in /ffp/start/. The scripts that are marked 'executable' will be run automatically at startup. To activate a script, e.g. mediatomb.sh, run:

    chmod a+x /ffp/start/mediatomb.sh

    To remove the 'executable' flag, run:

    chmod a-x /ffp/start/mediatomb.sh

    Example configuration files for some services are included in /ffp/etc/examples.

    Before the scripts in /ffp/start, /ffp/etc/fun_plug.local is run, if present and executable. You can use fun_plug.local for any commands you want to run during startup that don't fit in real start scripts. Examples:

    adjust clock ticks to reduce drift
    set your timezone
    remove firmware cronjobs


    /ffp/etc/examples/ contains an example fun_plug.local script. Note that you should set the PATH yourself early in in fun_plug.local. The fun_plug.local function was added in version 2008-08-11 of the fun_plug script.


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    iPhone. wrote: »
    Tried it and it works alright but doesn't survive a reboot.

    Okay, I've a partial solution.

    Create a file called /ffp/etc/fun_plug.local

    It's run by FFP after a reboot.
    The simple contents of this shell script will be
    cp /usr/local/zoneinfo/Europe/Dublin /etc/MyZone
    

    That works on a reboot.

    However that will be undone if you go into the NSA325 Administration pages, to the "Date/Time" page, and click on the "Synchronize Now" button beside the time server, then it will overwrite your setting again.


  • Registered Users, Registered Users 2 Posts: 1,104 ✭✭✭iPhone.


    Fair play, mad how difficult such a standard requirement is to implement though isn't it?


  • Registered Users, Registered Users 2 Posts: 28 hochnie


    iPhone. wrote: »
    Thanks for the detailed response, really appreciate the time it has taken you to do that!

    I'm still stuck at 'command not found' stage on the command line

    I can't for the life of me find the profile file or whatever the equivalent on the NSA310 is that stores the paths to see if I can add it there.

    Hi,
    I have been trying to get this running too. I have all the packages outlined by creeping death installed but I am getting "-vcodec: command not found"
    when I run

    ffmpeg -r 10 -f mjpeg -i hxxp://xxx.xx.x.x:xx/videostream.asf?user=admin&pwd=admin&resolution=320*240 -vcodec mpeg4 -qscale 0 -aspect 4:3 -y /i-data/dfa80fa7/IPCAM/video

    It appears to run ffmpeg but hangs in putty with no script until I stop it.
    the camera is eyecam.
    The ffmpeg package is the 2.1.3 compiled by barmalej, any ideas on this?
    thanks


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    Try putting quotes around the webcam URL


    ffmpeg -r 10 -f mjpeg -i "hxxp://xxx.xx.x.x:xx/videostream.asf?user=admin&pwd=admin&resolution=320*240" -vcodec mpeg4 -qscale 0 -aspect 4:3 -y /i-data/dfa80fa7/IPCAM/video


  • Registered Users, Registered Users 2 Posts: 28 hochnie


    Thanks for the reply.
    It needed the quotes alright but it also needed .avi otherwise I get an output error.
    I have had a problem getting your rectimelapse script to work where it does not like the ${NOW} or $DESTDIR arguments. If I remove these it seems to run fine but I would like to have time/date information on the files.
    any help is appreciated.
    thanks


  • Advertisement
  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    hochnie wrote: »
    I have had a problem getting your rectimelapse script to work where it does not like the ${NOW} or $DESTDIR arguments.

    Going by the values you've posted here, I'd expect your recordTimeLapse.sh script to be something like this
    export PATH=/ffp/sbin:/usr/sbin:/sbin:/ffp/bin:/usr/bin:/bin
    NOW=$(date +"%Y-%m-%d-%H%M")
    
    # Change the directory below to the directory you want to record to on your NAS
    
    DESTDIR=/i-data/dfa80fa7/IPCAM/video
    
    echo "Capturing $1 : $DESTDIR/test_${NOW}.avi"
    
    nohup ffmpeg -r 10 -f mjpeg -i "hxxp://xxx.xx.x.x:xx/videostream.asf?user=admin&pwd=admin&resolution=320*240" -vcodec mpeg4 -qscale 0 -aspect 4:3 -y $DESTDIR/test_${NOW}.avi > /dev/null 2> /dev/null < /dev/null &
    

    Both $NOW and ${NOW} work for me, even if I directly execute them in a simple telnet session eg.
    [root@mylinuxbox ~]# NOW=$(date +"%Y-%m-%d-%H%M")
    
    [root@mylinuxbox ~]# echo $NOW
    2014-06-03-1050
    
    [root@mylinuxbox ~]# echo ${NOW}
    2014-06-03-1050
    

    Can you confirm that you can perform the last 3 simple shell commands and it correctly output the date?


  • Registered Users, Registered Users 2 Posts: 28 hochnie


    yep those commands work in telnet but cause the .avi ext to disappear in the destination folder which in turn means it wont encode when I try to watch it on my samsung tv. To be honest I have kind of cheated by using {$(date +"%Y-%m-%d-%H%M")}.avi in the script file but it works.
    I probably need to learn how to write code before I commit to these things...
    Ideally I would like it to record in 24hour segments and auto delete files after a week/month of recording. I will have to a bit of research methinks..
    Is there any reason the recordtimelapse file would be removed from the bin folder whenever I restart the NSA?


  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    hochnie wrote: »
    yep those commands work in telnet but cause the .avi ext to disappear in the destination folder which in turn means it wont encode when I try to watch it on my samsung tv.
    To be honest I have kind of cheated by using {$(date +"%Y-%m-%d-%H%M")}.avi in the script file but it works.

    When you say the .avi extension disappears... do you mean in Linux or when you view it via a Windows machine ( which may hide the file extensions of "known types" ) ?
    hochnie wrote: »
    Ideally I would like it to record in 24hour segments and auto delete files after a week/month of recording. I will have to a bit of research methinks..

    Definitely, as the size requirements of recording 24 hours, even at crude VGA ( 640x480 ) resolution are considerable.
    I see 320x240 in your URL, but that's next to useless for any security application.
    I used a frame rate of 1 frame per second at 640x480 and I think I was ending up with roughly 1GB video files for 12 hours, so you'd have 2Gb for 24 hours.
    So you can multiple 2Gb per day by the number of frames per second you record, eg. 10 frames per second = 20Gb per day.
    hochnie wrote: »
    Is there any reason the recordtimelapse file would be removed from the bin folder whenever I restart the NSA?

    See another posters previous question on where to store the recordTimeLapse.sh. I definitely wouldn't store it in /bin, maybe /usr/bin instead.
    Although I have mine stored in a directory called FOSCAM off the root directory of one of my hard drives in the nas, but on the nas internal storage itself.


  • Registered Users, Registered Users 2 Posts: 28 hochnie


    Hi
    I am checking it from a linux machine and viewing also on my samsung tv with no problems though so happy enough with the result.
    The resolution will be set to 680*480 after I am finished testing although I am considering a Megapixel ip camera from ebay for a better image. The substream might also be useful for an intercom I will be putting in.

    eb*y.c*.*k/itm/POE-960P-1-3-MP-HD-onvif-25fps-24-IR-Outdoor-Security-CCTV-Network-IP-Camera-3-6-/281304883552?pt=UK_CCTV&hash=item417f13e160

    I guess all I would have to change would be the output format and resolution?

    I also added the line below to the start of the file to remove files older than 30 days.

    find /i-data/dfa80fa7/video/ipcam -mtime +30 –delete

    I have set the time in the script to record for sixty minutes and have created a cron task to run every hour.Hopefully all this will take care of all the older files.
    thanks for the help


  • Registered Users, Registered Users 2 Posts: 1 oscyp


    Hi all,
    I hope you could help.

    as soon as I type this line:
    ffmpeg -r 1 -i "h t t p ://192.168.1.197:6667/videostream.cgi?user=XXX&pwd=XXX" -t "0:01:00" -vcodec mpeg4 -an -y test.avi -an

    I have such message:

    ffmpeg version 2.1.8-compiled_by_barmalej2_for_ffp0.7arm Copyright (c) 2000-2015 the FFmpeg developers
    built on Jun 12 2015 20:36:16 with gcc 4.9.2 (GCC)
    configuration: --prefix=/ffp --enable-shared --disable-static --disable-armv6 --disable-armv6t2 --disable-vfp --disable-neon --disable-debug --disable-stripping --disable-ffplay --disable-ffserver --disable-indev=alsa --disable-outdev=alsa --enable-avresample --enable-gpl --enable-version3 --enable-libx264 --enable-libshine --enable-libmp3lame --enable-libtwolame --enable-libopus --enable-librtmp --enable-libass --enable-fontconfig --enable-libfreetype --disable-doc --disable-htmlpages --disable-podpages --disable-txtpages --extra-cflags=-Wno-deprecated-declarations --extra-version=compiled_by_barmalej2_for_ffp0.7arm
    libavutil 52. 48.101 / 52. 48.101
    libavcodec 55. 39.101 / 55. 39.101
    libavformat 55. 19.104 / 55. 19.104
    libavdevice 55. 5.100 / 55. 5.100
    libavfilter 3. 90.100 / 3. 90.100
    libavresample 1. 1. 0 / 1. 1. 0
    libswscale 2. 5.101 / 2. 5.101
    libswresample 0. 17.104 / 0. 17.104
    libpostproc 52. 3.100 / 52. 3.100
    Trailing options were found on the commandline.
    [mp3 @ 0x4ed90] Format mp3 detected only with low score of 1, misdetection possible!
    [mp3 @ 0x51f20] Header missing
    Last message repeated 163 times
    [mp3 @ 0x4ed90] Stream #0: not enough frames to estimate rate; consider increasing probesize
    [mp3 @ 0x4ed90] decoding for stream 0 failed
    [mp3 @ 0x4ed90] Could not find codec parameters for stream 0 (Audio: mp1, 0 channels, s16p): unspecified frame size
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    h t t p ://192.168.1.197:6667/videostream.cgi?user=XXX&pwd=XXX: could not find codec parameters



    I have used -an as my camera doesn't catch the audio. Anyway, how can I solve this issue?


  • Advertisement
Advertisement