I was trying to play a YUV file (e.g. the foreman.yuv clip from somewhere like here, or here) - the simplest way seems to be to get mplayer and run it like this (note the -rawvideo option indicates the file format - see mplayer man page for more info):
mplayer foreman.yuv -demuxer rawvideo -rawvideo cif
Or you can use Gstreamer (available for Linux, Windows, and OSX, though there's a problem using autovideosink on the cmd line on the Mac) like this:
gst-launch filesrc location=foreman.yuv ! videoparse width=352 height=288 framerate=25/1 ! ffmpegcolorspace ! autovideosink
You'll obviously need to change the resolution and potentially framerate for different video samples but these work with 'foreman' clip.
BTW if you want to compute the PSNR between two YUV files you can use ffmpeg's tiny_psnr utility like so:
tiny_psnr foreman.yuv foreman-mangled.yuv
Friday, 26 October 2012
Saturday, 20 October 2012
How to change the 'original' date on a JPEG photo
So you've got a photo with a weird date on it - how do you change it? Well on OSX or Linux you can do it the terminal using a handy utility called exif (which you'll need to get from macports or apt):
exif --tag 0x9003 --ifd='EXIF' --set-value='2012:10:17 16:30:37' myphoto.jpg
It will create a new file with the new date called myphoto.jpg.modified.jpg which you can then rename to the original or something else.
There are of course other tools but this one works for me. I'll list others if/when I come across them.
Note: In theory you could use iPhoto on OSX but it is unfortunately buggy - so if you have a date like 1/2/1911 and you try moving it forward with iPhoto then it sets a date earlier in time?!
exif --tag 0x9003 --ifd='EXIF' --set-value='2012:10:17 16:30:37' myphoto.jpg
It will create a new file with the new date called myphoto.jpg.modified.jpg which you can then rename to the original or something else.
There are of course other tools but this one works for me. I'll list others if/when I come across them.
Note: In theory you could use iPhoto on OSX but it is unfortunately buggy - so if you have a date like 1/2/1911 and you try moving it forward with iPhoto then it sets a date earlier in time?!
Wednesday, 25 July 2012
Windows networking more reliable on Time Capsule
So you're trying to connect/backup to your Time Capsule (1st Gen OS7.6.1) and it seems like it just died...? But you can still connect using the AirPort Utility? And it still pings.... Oh but wait you can connect to the disc using...... Yes Windows file sharing protocol (SMB/Samba). What's going on?!
It seems that Apple's File Sharing (AFP) server just dies - quite often. Indeed it would seem that the Time Capsule's AFP implementation is flakier than their Windows (SMB) server. That's handy for an Apple product?!
The annoying thing is that whilst you can connect to the thing using the AirPort Utility you can't restart it - it just hangs. So you have go and turn it on and off.
It seems that Apple's File Sharing (AFP) server just dies - quite often. Indeed it would seem that the Time Capsule's AFP implementation is flakier than their Windows (SMB) server. That's handy for an Apple product?!
The annoying thing is that whilst you can connect to the thing using the AirPort Utility you can't restart it - it just hangs. So you have go and turn it on and off.
Tuesday, 17 July 2012
Time Machine: Indexing backup......yawn....FIXED
Yeah it's getting boring seeing that message (and/or 'Waiting for index to be ready' in system logs /var/log/system.log) when your Mac is supposed to be actually backing up. I had this problem on Snow Leopard and then for a while on Lion but I now seem to have sorted it. I tried a few approaches and removing the spotlight index actually fixed it this time (though other times it has just been a question of waiting):
[Updated: 26oct12: Cleanup and Pondini link]
- Wait: It can take a loooong time to complete backups and indexing of backups so wait a few hours or even a day or so to see if it just sorts itself out.
- Repair Backup:
- Turn off Time Machine in the preferences.
- Mount the Time Machine Backups as follows: In Finder you navigate to your backup disk and then find your machine's actual backup file (your_computer_name.sparsebundle) and double click on it - it will put a new disk in Finder's sidebar: 'Time Machine Backups'.
- Then open up Disk Utility and select the 'Time Machine Backups' disk and click repair.
- Eject the 'Time Machine Backups' disk and re-enable Time Machine in the system prefs.
- Remove Spotlight Index: Follow steps (1) and (2) above then open a Terminal window and type the following:
sudo rm -rf /Volumes/Time\ Machine\ Backups/.Spotlight-V100
Then follow step (4) above. After this your backups may take longer for a day or so whilst Time Machine rebuilds its indexes but it should settle down soon. - Disable Spotlight for TM Backups: Spotlight can be disabled by firstly ensuring that 'Time Machine Backups' is
mounted (see (2) above). The going to Spotlight Prefs and adding the disk to the 'Privacy' section. Alternatively it can be done on the command line as follows:sudo mdutil -i off /Volumes/Time\ Machine\ Backups
[Updated: 26oct12: Cleanup and Pondini link]
Thursday, 5 July 2012
Field Test App on the iPhone 4
So it seems Apple keep chopping and changing whether they provide the [secret?!] Field Test App....But anyway it is in iOS5.1.1 (and iOS6) and works on iPhone 4S & 4, and probably 3GS (but not tested). You kick it off by typing the magic code (*3001#12345#*) into the Phone dialpad and then hitting Call. Note: It doesn't work if you add it as a contact and try to call it.
When it starts up it presents a pretty basic interface where you can navigate to find out various info about your GSM and UMTS/3G (and presumably CDMA) connections. It also changes the signal strength icon (top left) for a number - the smaller the negative the number the higher the signal (e.g. -44 represents a better/stronger signal than -99). If you tap the number it changes between the bars and the numbers again.
What the heck can you do with it? I guess it is handy sometimes to have numeric signal strength... And check up on some of the other parameters.
One thing you can do is find out the mobile base station your phone is attached to and then potentially match that with an actual cell location. It's a bit long winded.....In the UK the regulator Ofcom has created a fairly useful web page that provides the position of most cell towers overlaid onto a Google map. So to find out which cell you're attached to firstly check if you're on 3G or not (i.e. 3G icon showing or not - you'll need to turn off wifi to see if it is on though it doesn't affect the app):
If you are on 3G then you tap on:
'UMTS Cell environment'->'UMTS RR Info'->'Downlink Frequency'
The number on that line is the frequency in MHz your phone is using to communicate with the UMTS base station.
If you're not on 3G then you tap on:
'GSM Cell environment'->'GSM Cell Info'->'GSM Serving Cell'->'ARFCN'
If your ARFCN is between 1-124 then your phone is on 900MHz band 128-251, then it's using the 800/850MHz band, and if it is between 512-880, then your phone is using the 1800MHz or 1900MHz bands. A few sites give more details like this one on GSM/LTE, or there's GSM list from the gnu radio folks.
Once you've got this far then you can go look up your location in the UK use the the Ofcom sitefinder (or equivalent in your country) and find the cells near you. Then you have click on each on and find your providers ones and then locate the GSM or UMTS cell towers and then match up the frequencies used by those towers. Blimey that was a bit tedious but you should have got there! If you don't find any cell towers nearby or matching then maybe you've found an undocumented cell tower - report it to OfCom on their pages!
[30oct12: Added iOS6 info, and other minor tweaks]
When it starts up it presents a pretty basic interface where you can navigate to find out various info about your GSM and UMTS/3G (and presumably CDMA) connections. It also changes the signal strength icon (top left) for a number - the smaller the negative the number the higher the signal (e.g. -44 represents a better/stronger signal than -99). If you tap the number it changes between the bars and the numbers again.
What the heck can you do with it? I guess it is handy sometimes to have numeric signal strength... And check up on some of the other parameters.
One thing you can do is find out the mobile base station your phone is attached to and then potentially match that with an actual cell location. It's a bit long winded.....In the UK the regulator Ofcom has created a fairly useful web page that provides the position of most cell towers overlaid onto a Google map. So to find out which cell you're attached to firstly check if you're on 3G or not (i.e. 3G icon showing or not - you'll need to turn off wifi to see if it is on though it doesn't affect the app):
If you are on 3G then you tap on:
'UMTS Cell environment'->'UMTS RR Info'->'Downlink Frequency'
The number on that line is the frequency in MHz your phone is using to communicate with the UMTS base station.
If you're not on 3G then you tap on:
'GSM Cell environment'->'GSM Cell Info'->'GSM Serving Cell'->'ARFCN'
If your ARFCN is between 1-124 then your phone is on 900MHz band 128-251, then it's using the 800/850MHz band, and if it is between 512-880, then your phone is using the 1800MHz or 1900MHz bands. A few sites give more details like this one on GSM/LTE, or there's GSM list from the gnu radio folks.
Once you've got this far then you can go look up your location in the UK use the the Ofcom sitefinder (or equivalent in your country) and find the cells near you. Then you have click on each on and find your providers ones and then locate the GSM or UMTS cell towers and then match up the frequencies used by those towers. Blimey that was a bit tedious but you should have got there! If you don't find any cell towers nearby or matching then maybe you've found an undocumented cell tower - report it to OfCom on their pages!
[30oct12: Added iOS6 info, and other minor tweaks]
Tuesday, 12 June 2012
iCloud deleted/moved All on My Mac contacts?!
So I just tried adding my iCloud email to Apple Mail on my Mac and kept the 'contacts' checkbox ticked when Mail asked me to create the account setup. My iCloud account worked fine in Mail.
Then I went to Address Book and noticed that 'All on My Mac' contacts had been replaced with 'iCloud' on the first page of the address book (click on the red bookmarky thing on contacts to see it). Where had my 'All on My Mac' contacts gone??!! Well they had been copied over to iCloud with asking me.... So I thought I'd go and disable the iCloud account in Address Book - and 'All on My Mac' contact returned but they were completely EMPTY?! I don't necessarily want all my stuff synced to some [US] server farm - especially when I'm not even asked about it.
I sat back for a moment and thought about it... I then tried deleting the iCloud account and then it asked me if I wanted to delete all my contacts... or Keep them. I kept them and low and behold my contacts returned to 'All on My Mac'!
Then I went to Address Book and noticed that 'All on My Mac' contacts had been replaced with 'iCloud' on the first page of the address book (click on the red bookmarky thing on contacts to see it). Where had my 'All on My Mac' contacts gone??!! Well they had been copied over to iCloud with asking me.... So I thought I'd go and disable the iCloud account in Address Book - and 'All on My Mac' contact returned but they were completely EMPTY?! I don't necessarily want all my stuff synced to some [US] server farm - especially when I'm not even asked about it.
I sat back for a moment and thought about it... I then tried deleting the iCloud account and then it asked me if I wanted to delete all my contacts... or Keep them. I kept them and low and behold my contacts returned to 'All on My Mac'!
Tuesday, 17 January 2012
OSX application firewall not working: FIXED
Recently I encountered problem with the OSX
Application Firewall getting confused on Lion (and maybe even on Snow Leopard) - it basically blocks services (e.g. ssh) even when they appear to be set up with 'allow incoming connections' in the Advanced... section of the Firewall, under Security and Privacy, in System Preferences.
I managed to reset mine by doing the following (with the firewall off):
When the machine has rebooted in the Firewall advanced settings you should only see the system services that were already enabled (e.g. SSH). Any other entries will have gone, but when you start network based applications that need to accept incoming connections through the OSX firewall - you will be asked if you want to permit the application or not again.
I managed to reset mine by doing the following (with the firewall off):
sudo rm /Library/Preferences/com.apple.alf.plistThen reboot.
When the machine has rebooted in the Firewall advanced settings you should only see the system services that were already enabled (e.g. SSH). Any other entries will have gone, but when you start network based applications that need to accept incoming connections through the OSX firewall - you will be asked if you want to permit the application or not again.
If for some reason the Advanced firewall settings have not changed then ensure the firewall was off when you removed the file and also you could try killing the process named 'writeconfig' (which actually opens that config file) - however you should reboot soon as there may be unexpected consequences.
For more info Apple's Application Firewall see here. Also note that Apple's application firewall is different to the old BSD/Dummynet ipfw firewall - which maybe controlled via the ipfw command (see the man page - e.g. man ipfw). ipfw provides lower level firewalling and can provide for more general network restrictions and control.
Thursday, 1 December 2011
Linux traffic Control (tc)
The world of Linux's Traffic control is a mysterious thing - you end up spending hours Googling or days reading source code.
For some nitty gritty on tc see an earlier post of mine on tc rate limiting and pitfalls.
TC Queuing Disciplines (qdisc)
Creating:
E.g Add a tbf qdisc on eth0:
Listing:
E.g. Show qdiscs on all interfaces:
Delete:
E.g. Delete all qdiscs on eth0 interface:
TC Filters
Creating:
Here's some good info on the u32 filter (here and here). Some more with a quick overview from LARTC mail list (the source of most useful info on tc etc). Someone put together a tc manual.
Listing:
E.g. Show filters on eth0 interface:
Here's some example output:
Deleting:
To delete the above example filter (bold section copied from filter show output):
[updated:17feb12, 5,6jul12,29jan20: more explanations+archive.org link for 1st link as it's gone MIA, link to older article of mine; Added TC qdisc cmds]
For some nitty gritty on tc see an earlier post of mine on tc rate limiting and pitfalls.
TC Queuing Disciplines (qdisc)
Creating:
E.g Add a tbf qdisc on eth0:
sudo tc qdisc add dev eth0 root tbf rate 10mbit burst 100kb latency 50ms
Listing:
E.g. Show qdiscs on all interfaces:
tc qdisc show
Delete:
E.g. Delete all qdiscs on eth0 interface:
sudo tc qdisc delete dev eth0 root
TC Filters
Creating:
Here's some good info on the u32 filter (here and here). Some more with a quick overview from LARTC mail list (the source of most useful info on tc etc). Someone put together a tc manual.
Listing:
E.g. Show filters on eth0 interface:
sudo tc filter show dev eth0 root
Here's some example output:
filter parent ffff: protocol ip pref 49152 u32
Deleting:
To delete the above example filter (bold section copied from filter show output):
sudo tc filter del dev eth0 parent ffff: protocol ip pref 49152 u32
[updated:17feb12, 5,6jul12,29jan20: more explanations+archive.org link for 1st link as it's gone MIA, link to older article of mine; Added TC qdisc cmds]
Subscribe to:
Posts (Atom)