Showing posts with label Video. Show all posts
Showing posts with label Video. Show all posts

Sunday, 13 December 2015

D-Link IP Camera setup on Linux Mint

Well last night I gave in to shopping temptation and got a D-Link DCS-932LB1

Dlink pictire

It was cheap and on offer and although it only said Windows / Mac use I thought I would take a chance to get it working under Mint. That BUY NOW button eh !

So first I found Zone Minder, which looks a great program but I had real trouble setting it up so I gave up trying after following a few guides. Something to do with systemd and systemctl I could not figure out.
So I looked for something simpler and I found it.

Motion

I've just started to play with it but I need to get this down before I move on to saving video and using it via my android phone & other places, so the basics of setting it up.

First I found a guide on how to just set up the camera with my router at sensor.org

This was basically connect by ethernet cable to my router
plug the camera in
navigate to my router setup homepage where I found the WPS connection button,
then press the button on the back of the camera and the WPS button on the setup page
The router found the IP camera and I was away.

I found the new connection on the list of active connections on the router info page
copied the internal IP address 192.168.x.x
and pasted it into my browser
This brought up the IP cameras setup page where I entered the supplied username and password
from the manual. The first thing I did was change this and follow the setup from there
keeping the simplest options for now.

I was now ready to install Motion

sudo apt-get install motion
sudo apt-get update

apparently this should automatically create a

motion group (I learnt a bit from trial and error about there from installing Plex !)
it should also add a motion user

This info is on Linux.com at how to operate linux spycams with motion

after making sure this was right I started motion

$: motion

mistake it wouldn't give permission to use
silly me

$: sudo motion

and it started up. I then found it had failed to find the video device

I followed the instructions on Linux.com down to the point where the author talked about
permissions again.

Her name was carla so I noticed she gave the instructions

~$ sudo chown carla:carla .motion/motion.conf
Her group name was obviously carla and so was her user name.

I replaced the carla with my group name and user name so it all worked.

I followed the info to make more directories then saved localhost:8081 and localhost:8080 to my browser favourites
The first port 8081 is the feed to see the camera output and the second port 8080 is the configuration
file where you can enter and change different set up options.

I went to config then list and all the changable options were there

To see my camera I then went back to the IP Camera's setup page and found the link to the feed by
right clicking on the video feed and using inspect on my chromium browser to pick up the link as shown on Linux.com.

pasting that link into netcam_url =
and then pasting admin:mypassword
into netcam_userpass =

Bang. the feed came up on the hocalhost:8081 webpage

Now I can mess about with other options another day to add functionality

Saturday, 22 August 2015

Setting up my Time lapse Raspberry Pi Camera with a shut down switch

Lets do it !


Well this post is a little bit about Linux Mint as I'm using it to set up and transfer files to my Time Lapse Camera I have made from a "Raspberry Pi" Micro computer but also because it links in to my last post which was about joining the shots I'd made into a short time lapse Video.

Let's get this down while I have the tabs open on my browser I've used and it's fresh, in case I need to do it again.

About the Camera


I set up a simple camera time lapse using the camera module for the Pi and set it off connected to a mobile phone battery back up pack.

These are ridiculously cheap on e-bay from China without the batteries inside, currently about £2 including shipping. They're searchable as Rechargeable USB LED Mobile Power Bank Charger 4pcs 18650 Li-ion Battery Case

People give me old out of date or none working Laptops and so I ripped the Lithium batteries out of the battery pack of one of these. The nice Panasonic batteries were checked on my multimeter and they all seemed OK so I put 6 of them inside the battery pack casing and set it on charge through the USB port of my PC.

By the way most laptops seem to hold battery packs of the type 18650. You can buy them on e-bay but there are types with a nipple on the plus end and types that are flat on both ends. My batteries from the laptop fitted in the case but some new ones I also bought 4x 4200mAh UltraFire 18650 3.7V Rechargeable Li-ion Battery  were shorter and were loose when put in so I did not use them.

I now had a portable time lapse camera I can take anywhere and it will take a picture every one minute for as long as the batteries last.

The set up for the Camera time lapse is available as a worksheet on the Raspberry Pi  learning website
https://www.raspberrypi.org/resources/

This is just a prototype and I want to add other features to it as I go along so nice start.

What now

After setting up the Camera to capture the scene outside my window onto the street I left it running overnight to see how long the batteries would last before they cut power to the Pi. The shots were saved as in the worksheet instructions to save date and time so I would know how many hours by just checking the time stamp on the pictures.

Well that all worked and I took the mini SD card (or TF card if you're from China) from out of the Pi and connected it to my PC, copying over the "Camera" folder to my Linux desktop and then using imagemagic in TERMINAL as described in my last post.

Now to the crux

The battery lasted enough time to get a nice sunrise over my car and onto the street but then I had the issue of shutting down the Pi. (Switches to present tense)

I don't want to damage the file system on the SD card by too many hard close downs from loss of power. I can do this by adding something to my script to fix the time and amount of shots taken before the script tells the Pi to shutdown the operating system (don't know how to do that yet but it is something I will research and learn). 

I also would like to be able to just press a button and ask the Pi to stop taking shots and shutdown the operating system itself before the battery does it for it by dying.

The little portable setup won't be connected to a monitor and keyboard and also I don't want to always have it connected to a ethernet cable or have a WiFi receiver plugged in. 

The only choice is a soft shutdown button.

Now there are a load of pages on the Internet on how to do this but my problem with them is if they are written by experts, they forget the simple stuff or miss vital bits out expecting you to know it.

If they are written by novices they seem to do everything the longwinded way with un-neccsary steps that just add to the confusion.

It's difficult to find something at my "tinkering" level. Oh well, that's life.

So this is How I have done it after lots of wasted hours.

The actual Process

This is for the Raspberry Pi model B+.  I have one of the earlier models, the B but I don't like doing anything that could screw it up with it.

First all the pages I looked at had everybody doing the complicated stuff on the Pi first connected to a monitor. For desktop stuff I think the Pi is just way to slow to do these things. After my initial setup of the card and Pi using a monitor I noted the IP address of the Pi and enabled SSH in (sudo) raspi-config so I could access it from my main computer.

All my editing of files were done by cutting the code from my browser then pasting into gedit the linux mint notepad, saving this file to my desktop and using Filezilla the FTP program to transfer that file to the correct folder on the Pi.

I used PUTTY to  do any other things such as making the files I had sent over read or writable using chmod to change the permissions, and for shutdowns.

The best resource I found was an article on the Rasbperry Pi forum but to me I felt it was over complicated. There were lots of comments made to improve the result but all left out important bits leaving a guide which seemed to be do it wrong then change this bit by bit until it works this way.

I had to go through everything to pull out a relevant and simple process.

First rip a small monetary switch from some old press button electronics board or buy new. They are tiny and just connect when pressed down for a moment. 

Then check they open and close forming a circuit. I used a light and battery to create a simple series circuit to check the legs of the switch as I could only find square 4 leg switches in my scrap box and didn't know which leg connected to which.

I then cut of the wires from an old PC fan connector that fits into the headers on a motherboard. They are small and thin black power connectors. You'll see them and know they are perfect to connect to the headers on the Pi.

Solder the micro switch to the two wires from the flat black connector (it may have two or 3 holes in it depending where you got it from) and you have your plug in switch. This should just slide gently over the pins 5 and 6 on the Model B+

Count in from the top left by the mounting hole, use a guide first to see where they are. 2 , 4 , 5 and 6.

Now cut and paste the code from the forum post below into gedit. I used the code by "ame" at the end of page one as the later code didn't work for me. 

Save it as shutdown.py.

FTP the file to the Home/Pi/    folder

Use PUTTY to access the Pi and in TERMINAL go to the Home/Pi/ folder where everything is and chmod +x shutdown.py to change file permissions.

Then enter the Cron system that sets up timed events by crontab -e

Go to the bottom of the file and add at the end

@reboot /home/pi/shutdown.py


Save this. Shutdown the Pi and disconnect, fit the switch wherever you want it and connect it all up again.

After the reboot you should just be able to press the microswitch quickly and the Pi will shutdown from within with a shutdown call. the lights will flicker then go to a solid red. One more tap and the Pi will come out of hibernate.





Links to resources I've used and were useful.

https://www.raspberrypi.org/documentation/usage/gpio-plus-and-raspi2/

Shows GPIO points on the Raspberry Pi B+ I used, they're different from the B model

https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=106410

Called "Solderless clean shutdown/boot switch" if it moves.

http://www.trevorappleton.blogspot.co.uk/2013/11/creating-time-lapse-camera-with.html

https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=67109

Friday, 21 August 2015

Rotating timelapse Images in bulk & converting to AVI using ImageMagic

CD to your folder  eg.

TERMINAL

cd Desktop/camera/



Make a bash script. My images are upside down so I need the rotation 180% using ImageMagic's convert.


TERMINAL


for file in *.jpg; do convert $file -rotate 180 rotated-$file; done


This script takes files all files (* wildcard) within the folder that are jpg format and rotates them 180 degrees. It then renames the file by adding a "rotated-" to the start of the file name.

I just remove the unrotated jpg's cos I'm lazy then

TERMINAL

ls *.jpg > stills.txt


List all jpg files and send that down a pipe to a text file called stills.txt

I can then use memcoder (if installed) to convert the timelapse pictures to a short avi video

mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o timelapse.avi -mf type=jpeg:fps=24 mf://@stills.txt

Sunday, 12 January 2014

Fixing Channel 4OD & Demand5 Video playback

So, I've always had a problem playing back 4OD streaming content. I've tried lots of fixes and none worked. I've finally found a fix that does work on this link.

http://forums.linuxmint.com/viewtopic.php?f=90&t=146676

Just in case it disappears the  process is:

Remove the adobe cache

Terminal
rm ~/.adobe -rf

Install hal and hal-info (hardware abstraction layer)

Terminal
sudo apt-get install hal hal-info

Then link (ln) hal between /usr/share and /etc/ (make sure of the space between hal/ And /etc/)

Terminal
sudo ln -sn /usr/share/hal/ /etc/hal

I then went to the adobe folder

Terminal
cd ~/.adobe/Flash_Player

and removed the three files NativeCache, AssetCache, APSPrivateData2

Terminal
rm -rf NativeCache AssetCache APSPrivateData2


I don't know if all the steps are needed but it seemed to work so I'm happy !

UPDATE:

Well since I upgraded to Mint 16 Petra, which uses Ubuntu Saucy
 13.10 Demand5 stopped working.
Found a fix here though:

http://www.omgubuntu.co.uk/2013/10/fixing-amazon-prime-streaming-drm-protected-flash-13-10

Quick note, close down chromium fully when in terminal, I cut and pasted the notes into Tomboy first. The Chromium icon is next to the time on the right side of the lower menu bar. Right click and exit fully closing the browser down. On next restart it should work using the ppa version fix I used.

Thursday, 29 August 2013

All in one converter

FF Multiconverter

Converts Video, Documents and Images.

Terminal



sudo add-apt-repository ppa:ffmulticonverter/stable
sudo apt-get update
sudo apt-get install ffmulticonverter




Supported formats:

Audio/Video formats:

aac, ac3, afc, aiff, amr, asf, au, avi, dvd, flac, flv, mka, mkv, mmf, mov, mp3, mp4, mpg, ogg, ogv, psp, rm, spx, vob, wav, webm, wma, wmv
And any other format supported by ffmpeg.

Image formats:

bmp, cgm, dpx, emf, eps, fpx, gif, jbig, jng, jpeg, mrsid, p7, pdf, picon, png, ppm, psd, rad, tga, tif, webp, xpm

Document file formats:
doc > odt, pdf
html > odt
odp > pdf, ppt
ods > pdf
odt > doc, html, pdf, rtf, sxw, txt, xml
ppt > odp
rtf > odt
sdw > odt
sxw > odt
txt > odt
xls > ods
xml > doc, odt, pdf

Thursday, 22 August 2013

Iomega Buzz and Linux

This is a really old capture card and unit I had lying about in a box that I decided to hook up after having loads of problems with my EasyCap USB capture device. Once this worked but now, whatever I do it will not.

Anyway I thought why not throw the card in the PC and see what happens ? If nothing else I will have a SCSI card that may come in useful one day (the Card has one built in).



Well it wasn't as easy to get results as I was hoping until today when I decided to go back to it and try again.
The latest Mint Olivia has drivers for this models chip built into the Kernel but I have never up to yet got it to display video, until now. I found a post on the Ubuntu forums referencing people having problems with the aforementioned EasyCap device. Someone had posted a solution for getting video out of it. Well it didn't work for MY easyCap when I tried it but I thought as it's plugged in why not check the fix out using the Buzz ?

It worked !

So, this solution.....

Apparently the EasyCap assumed (my simple understanding) that input from the transmitting device, whether it be a Camcorder, VCR, camera, Satellite receiver, whatever was transmitting S-Video format, so if you are using the composite input to the EasyCap you would get no Video unless you were sending an S_video signal using the S-Video input.
I have no S-Video leads for anything so had never checked if anything worked this way. All my old stuff has composite or SCART outputs which I use a SCART to Composite converter plug on.

(Composite is the Yellow Phono plug usually next to the Red and White Audio out plugs on old stuff)



I digress, I connected up everything as I would normally for a test on a little camera I have that sends a live composite signal. I fired up "Cheese" my webcam application, checked its properties and set it to /dev/Video1 which is my little webcam and got a nice reflection of myself waving to myself on screen. So it works for that. I then changed to /dev/Video0 which is the Iomega buzz...Blank screen.
I then closed down Cheese and opened terminal, entering the fix from the forum.

Terminal

sudo apt-get install v4l-utils

This installed the v41 utilities for the Linux Video driver V4l. Then on installation

Terminal
v4l2-ctl -d /dev/video0 -i 0

This is a direct command to tell the system whether the input is composite on /dev/Video0
Opening "Cheese" again I selected /dev/Video0 once more in preferences and found a video feed that could be watched or recorded. I now need to check out my old VCR tapes and see if it records the sound also, but that's another day.
I don't yet know if this will be permanent on a reboot or if I will have to make a configuration file for this. I will know tomorrow.

The info along with how to set things up with VLC Player can be found (after a long scroll to the end of the thread) at:


Thanks Guys !!

Wednesday, 21 August 2013

Get Plex Media Server Running Quick

OK so I've had to install Plex Media Server a few times and had problems because I had no idea what I was doing. I've read various forums and the Plex site, all of which make it seem so complex to do.
This time I knew what the problem was and did it simply and quickly.

There is no up to date Plex software in the repositories so I had to go to the plex site and download the Ubuntu 64 bit version that comes in a debian package.

I then double clicked on it to install it using the debian installer. Upon installation I opened up the menu and found under "Other" the menu item for Plex.

This opens up a webpage as it tries to log into the server as it runs. I skipped past this to the add folder page where you add your folders containing your video.

Now we come to the problem that many a page of rubbish has been written and people who know what they are doing complicate.

The problem is "permissions". The server (Plex) needs permission to read and write to the folder containing the video files.

I use my Video folder which is set up with the install of Mint in the home folder.

The easy way to set this up from the desktop without having to go into Terminal is to navigate to the home folder, right click on this folder to bring the menu up and "open as root". You need to have root permission to give Plex the permissions it needs because Plex is further down the pecking order you may say.

On putting in your password the folder will open to show its subfolders, one of which is Video (where I keep my Video files). By right clicking again on the Video folder and going to properties you open this tabbed screen where the second tab is permissions. Here is the owner and groups that can use the files within.

Go to group and scroll down the list of applications next to it until you reach Plex. You can now define which permissions plex has within these folders. Give it read and write permissions, tick the apply permissions to enclosed files and close the tab.

Voila, you can now return to the Plex web browser screen and add the Video folder or any other folders within it you wish to designate for movies, home, movies, music etc.

One other thing if there are still problems try changing permissions in the /home/.plex folder and /usr/lib, basically anywhere plex may want to write something like a config or log file. I'm just thinking of this offhand and can't exactly remember where the places are it does write but it makes sense doesn't it.

Monday, 5 August 2013

ATI Graphics fix for Radeon HD2*** - HD4*** Cards

Well I fixed this once but then after messing about adding a Nvidia external card to my system I broke it and had to go through the painful experience of finding the fix again.
So better write this down.

The Problem.

It seems that ATI Radeon Graphics Cards and built in motherboard Graphics using these chips (such as my ASRock 960GM Motherboard) are a bit problematic when installing the propriety drivers and the open source drivers are a bit crap (up to yet).

It has problems using the Cinnamon desktop and manifests itself by only using software rendering which has meant using 45% of the processors power and the fan runs hot and crazy sometimes. I also noticed no hardware 3D.

The reason.

After some reading and a lot of red herrings from various forums it comes down to ATI no longer supporting the Linux drivers for these cards, series Radeon HD 2*** through to Radeon HD4***. Mine is an onboard Radeon HD3000.
It seems as the x-org server which runs the desktop behind the scenes has been updated this has created incompatibilities with the driver.
The newer versions of the ATI Catalyst propriety installation program for Linux will not work for the older cards / chips and are not supported anymore.

The Solution.

The only way to fix this is to downgrade your x-org server to an older version and then install the legacy (old) driver that last worked fully.
Luckily Tomasz Makarewicz has made a fix for this and a web search for his site shows you how. https://launchpad.net/~makson96/+archive/fglrx

Now I followed his instructions but still had problems with Cinnemon not running. It crashed on start up.
I wasn't the only one and found an interesting fix on the Linux Mint forums. I can't remember the link though and this guy needs some credit too. I did write down his process to do after the makson96 fix was done and this has fixed everything. Even the Catalyst adjustment program works on the menu.
This is it.

Reboot ...... Cinnemon crashes.....

Open terminal

sudo apt-get remove --purge xorg-driver-fglrx fglrx*

sudo apt-get install --reinstall libgl1-mesa-dri xserver-xorg-core

sudo dpkg-reconfigure xserver-xorg


He then says delete xorg.conf which is in the ./etc/ folder but I don't think this is necessary.

Anyway then reboot. I did it straight from the terminal with

 sudo reboot

Voila !!! My sytem was working with the ATI drivers.

Next Job getting duel monitors working. that should be fun.

Saturday, 18 May 2013

Convert Youtube videos on the fly

Use VLC to convert and save the audio (for example) from youtube.

Open VLC

Use CTRL + R to open Media Tab and move over to Network Tab

Paste in URL of the file from the browser bar

Go to the bottom of the tab and press the upside down triangle next to the "Convert/save" button

This opens the options screen where you can change the quality  and other options.

Change output to mp3 or flac (whatever your choice), change anything else you want to

Name your output file and path

Press convert/save button


Alternative that may work to download Videos directly.

Put an 'ss' if front of 'youtube' in the url

Wednesday, 24 April 2013

youtube-dl

youtube-dl can download from media sites. Install from software centre

Terminal

To update;
youtube-dl -U

Use;
youtube-dl "http://www.**************.com/watch?v=foobar"

* Copy the website address and change foobar to name you want to call file. File will be saved a "flv" Flash Video format file.

use -f switch to check formats available to download.

youtube-dl "http://www.**************.com/watch?v=foobar" - f

shows formats

example (also downloading subtitles as mp4 to current folder with original name)

youtube-dl "http://www.**************.com/watch?v=BlAhBlahBlah" -f 18 --embed-subs

For help;

 youtube-dl --help


GYD is a frontend for youtube-dl

Strip languages from large (extremely long or with multiple language options) subtitle files using “Handbrake”


I have come across subtitle files that would not open in Gnome Subtitles or any other editor due to their size (multiple languages). I just wanted the one subtitle language burned into file not an option to choose all the languages available in the original.

As I said all the Linux subtitle editors I tried just could not cope with such large files with the scripts for many languages in them.

So I needed to find a way of removing the superfluous language scripts first before hard coding the single language subtitles on top of the video feed to stream from Plex media Server to my TV.

This is also a quick dirty way to "burn in" idx, SUB files for use on media players that do not support these forms of subtitles. My Plex Player for example.

Open MKVMerge

First we will add our SUB, IDX or stb to the film in one Matroska container / Wrapper.

Click "add" and add the video file to the place entitled input box then "add" again to place the subtitle file in there too.



The box below entitled  Tracks, chapters and tags now shows all the elements you have added. If you have multiple text / sub files in different languages and you only need your language just deselect the boxes with other languages named next to them. This will leave you with a Video stream, an audio stream and a text file in your language.

Hit  "start muxing" at the bottom.

Wait a few moments until it has finished. Have a look where it saved the file  by checking the "Output filename" box for the path and name (you could have changed this but you didn't).

Remember this path.

You now have new container combining all files needed.



Open Handbrake. (handbrake is not officially supported as of writing and is not in the repositories, you will need to add it's source and then install)

Open subtitles tab.

It should say TRACK and underneath {language} (VOBSUB)

4. Select “burned in” button. Re-encode file by pressing start.

5. Done.

Convert SUB files to SRT

Use sub2srt

NOTE; Does only "subrip" and "microDVD". It does not convert "vobsub" or DVD-Subtitles.

This is a perl-script. Place it in a directory in your $PATH

eg.

/usr/local/bin 
or
/usr/bin

sub2srt --help for switches and use of.

Convert Bin / Cue to ISO

How to convert Bin / Cue files to ISO

Use command line programme bchunk (BinChunker)

Terminal

sudo aptitude install bchunk


BinChunker syntax

bchunk [-v] [-p] [-r] [-w] [-s] {image.bin} {image.cue} {basename}

Available options:

-v – Makes binchunker print info messages
-w – Makes binchunker write audio tracks in WAV format.
-s – Makes binchunker swap byte order in the samples of audio tracks.
-p – Makes binchunker go into PSX mode and truncate MODE2/2352 tracks to 2336 bytes at offset 0 instead of normal 2048 bytes at offset 24.
-r – Makes binchunker output MODE2/2352 tracks in raw format, from offset 0 for 2352 bytes. Used for MPEG/VCD.
Example:
bchunk IMAGE.bin IMAGE.cue IMAGE.iso