View Full Version : linux tips with canon HF10/HF100


jape41
06-24-08, 08:28 PM
I didn't find this info easily with google, so I thought I would aggregate it here.

Getting Files via supplied USB cable
The device seems to have 2 USB modes. It seems to pretend to either be a camera, or a USB mass storage device. The storage device behaviour will let you get both pictures and video off the camera, though you can use gphoto2 to get the pictures off it in "camera mode". If you have the device in "view picture mode" when you connect it to the PC, it will behave like a camera, if you have it in "view movie mode" it will act as a mass storage device. Here's the steps I use:

attach the camcorder to the it's power source
turn the function selection dial to the blue movie camera icon
connect the usb cable to the camcoder
plug the usb cable into the PC
power on the camcorder
the screen on the camcorder will prompt you for the type of usb connection; select PC/Printer
If you are lucky the device will automount for you. If not you can mount it manually


Mouting the device manually
First we need to find out what device the usb subsystem has mapped the camcorder to. Open a shell and type "dmesg". This should generate some cannon-like-usb data near the end:

scsi 12:0:0:0: Direct-Access CANON VIXIA HF100 1.00 PQ: 0 ANSI: 2
sd 12:0:0:0: [sdb] 15728640 512-byte hardware sectors (8053 MB)
sd 12:0:0:0: [sdb] Write Protect is off
sd 12:0:0:0: [sdb] Mode Sense: 03 00 00 00
sd 12:0:0:0: [sdb] Assuming drive cache: write through
sd 12:0:0:0: [sdb] 15728640 512-byte hardware sectors (8053 MB)
sd 12:0:0:0: [sdb] Write Protect is off
sd 12:0:0:0: [sdb] Mode Sense: 03 00 00 00
sd 12:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1
sd 12:0:0:0: [sdb] Attached SCSI removable disk
sd 12:0:0:0: Attached scsi generic sg1 type 0
usb-storage: device scan complete


The important part is the "sdb1". This is the device to mount. As root:

# mkdir /camera
#mount /dev/sdb1 /camera
#cd /camera
# ls -al
total 132
drwxr-xr-x 5 root root 32768 1969-12-31 19:00 .
drwxr-xr-x 22 root root 4096 2008-06-24 20:04 ..
drwxr-xr-x 3 root root 32768 2008-03-29 04:29 dcim
drwxr-xr-x 2 root root 32768 2008-03-30 01:01 misc
drwxr-xr-x 3 root root 32768 2008-03-29 04:13 private


Still pictures can be found in: dcim/101canon
The movies can be found in: private/avchd/bdmv/stream

Playing the .mts (AVCHD) files
Mplayer supports playing these files, but you will need to build mplayer from source. Follow the instructions on getting the source from subversion on the mplayer download page:
http://www.mplayerhq.hu/design7/dload.html

You will also need the binary codecs from the same page.

mplayer needs you to supply a fps ( frames per second) value for the video files you want to play. ie:

mplayer -fps 29.97 myfile.mts

Caveats

Mplayer seems to be playing the files correctly, but I can't be sure since my Athlon64-3000 doesn't seem to be powerful enough to play the 1080i60 files I've tried.
Now that I think about it the HF10 is probably a bit different since it has flash built in, along with support for the SDHC card.


Corrections or futher tips appreciated.

regards,

jp

img eL
06-25-08, 09:49 AM
Wow i hope u can get a more powerful system. Playing 1080i60 avchd files in linux without converting is amazing!

jape41
06-25-08, 07:15 PM
Out of curiosity, what are your system specs? I'm interested in building a new mythfrontend capable of playing the 1080i60 .mts files. Is it true that there is no video card acceleration support (ie xvmc or equivalent) for playing these files on linux?

img eL
06-27-08, 08:00 PM
I'm looking to upgrading some time. My main setup right now is just a 2 GHz T7200 core 2 duo, 2GB of memory, NVIDIA GeForce GO 7600 w/ 256 MB. I'm not able to play straight avchd files in linux yet. Keep us tuned

jape41
11-01-08, 11:05 AM
A few updates:

- mplayer/ffmpeg decoding of these files is single threaded. This means that mplayer will not be able to take advantage of multi core systems when playing these files. Basically you need more GHZ, not more cores

- you definitely will want a video card with xvideo support for hardware video scaling. My ATI chipset is not fully documented so no open source driver is available. I have to use the proprietary ATI drivers. I also needed to manually adjust my xorg.conf to include textured video support ( Option "TexturedVideo" "on")

- so far the closest I have come to playing my 1080i60 .mts files is:

mplayer -fs -ao alsa:device=spdif -lavdopts fast=1:skiploopfilter=all -srate 48000 -fps 59.94 file.mts

but my AMD 2.6 GHz X2 5000 seems underpowered. Mplayer is easily chewing up 90%+ CPU on it's core and I wind up with many of these logs printed out:
Too many video packets in the buffer: (127 in 8393208 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.


- This blog is a bit old, but I found it useful:

http://blog.charlies-server.com/2007/09/13/hd-video-playback-in-linux

Based on my experiences I wouldn't recommend this camcorder to linux enthusiasts, unless you are OK with transcoding the recordings.

regards

jp

jape41
11-07-08, 08:08 PM
More useful info I came across:

http://blog.mymediasystem.net/?page_id=14

jape41
07-12-09, 07:27 AM
Well, being stubborn and refusing to transcode these files, I was eventually able to play the files after upgrading my CPU to an AM3 AMD Athlon II X2 250. The current radeon drivers have support for xvideo, and with a current mplayer svn compiled for 64bit ubuntu, my CPU usage during playback is about 70% for mplayer and 20% for xorg. (note dual core, 200% total, free CPU=~100%)

The command I'm using minimized CPU usage, and offloads audio to my dolby receiver:

mplayer -fs -vo xv -fps 60 -ao alsa:device=hw=0.1 -ac hwac3 -framedrop -lavdopts threads=3:fast:skiploopfilter=all file.mts

video output is over HDMI at 1920x1080

regards

jp

mspice
12-29-09, 10:00 AM
I want to test out my system and using mplayer/mencoder with these types of files before getting one of these Canon cameras. Would someone be willing to post some sample .mts files to test with? Also, this would give me an opportunity to judge the quality of the camera as well.

Thanks in advance!

Shadow_7
12-29-09, 11:28 AM
hv20.com has an hv20.info ftp site with many canon samples.

$ mplayer -idx -geometry 0:0:0:0 -vo xv -ao alsa -brightness 0 -contrast 0 -monitoraspect 1.6 -cache 2048 -lavdopts skiploopfilter=all ./file.mts

-geometry makes it top left with no border.

-monitoraspect because ati's driver doesn't get the aspect ratio right without it when using xv. 1280x800 display on the laptop. 1280/800 == 1.6

-lavdopts skiploopfilter=all to do the least amount of post processing.

And various other ways to speed things up. i.e. close your web browser, too many sites have animated gifs, flash movies, java applets, and other cpu hogs going on and on and on ...... Even those little emoticons hog a lot of cpu when you have 40+ of them on the screen.

h-munster
12-31-09, 03:14 PM
Try both "-demuxer lavf -vc ffh264" or just "-demuxer lavf" or just "-vc ffh264".