Difference between revisions of "2253 Raspberry Pi"
From Sensoray Technical Wiki
(Created page with "== Compiling the 2253 driver on a Raspberry Pi board == Assuming Debian Raspbian installed, verify that build-essential and dkms packages are installed. sudo apt-get insta...") |
(→Compiling the 2253 driver on a Raspberry Pi board) |
||
(5 intermediate revisions by one user not shown) | |||
Line 5: | Line 5: | ||
sudo apt-get install build-essential dkms | sudo apt-get install build-essential dkms | ||
− | |||
− | + | Choose one of the following methods to install the kernel headers: | |
− | + | * Install the kernel headers through apt (works as of 25 Mar 2019) | |
+ | |||
+ | sudo apt install raspberrypi-kernel-headers | ||
+ | |||
+ | * Find out the version of the kernel using <code>uname -r</code>, then download and install headers package for version of kernel from https://www.niksula.hut.fi/~mhiienka/Rpi/linux-headers-rpi/ | ||
sudo dpkg -i ./linux-headers-4.1.18+_4.1.18+-2_armhf.deb | sudo dpkg -i ./linux-headers-4.1.18+_4.1.18+-2_armhf.deb | ||
sudo apt-get install -f | sudo apt-get install -f | ||
+ | |||
+ | * Use the <code>rpi-source</code> command to install kernel source (recommended if the other option gives an error) See also: https://www.raspberrypi.org/forums/viewtopic.php?t=76261 | ||
+ | |||
+ | sudo rpi-source | ||
Compile the driver: | Compile the driver: | ||
Line 19: | Line 26: | ||
sudo make install | sudo make install | ||
− | If the modprobe fails, the install step may have put the driver in the wrong modules directory if the kernel version has '+' at the end. | + | If the modprobe fails, the install step may have put the driver in the wrong modules directory if the kernel version has '+' at the end. |
+ | Fix by doing: | ||
sudo mv /lib/modules/4.1.18/extra /lib/modules/4.1.18+/ | sudo mv /lib/modules/4.1.18/extra /lib/modules/4.1.18+/ | ||
sudo depmod -a | sudo depmod -a | ||
sudo modprobe s2253 | sudo modprobe s2253 | ||
+ | |||
+ | Note: a better way may be to follow these instructions: http://billauer.co.il/blog/2013/10/version-magic-insmod-modprobe-force/ | ||
Line 35: | Line 45: | ||
'video/x-h264,standard=255,format=MP42,width=720,height=480,framerate=30000/1001,pixelformat=h264,profile=high' ! \ | 'video/x-h264,standard=255,format=MP42,width=720,height=480,framerate=30000/1001,pixelformat=h264,profile=high' ! \ | ||
h264parse ! mpegtsmux ! filesink location=recording.mp4 | h264parse ! mpegtsmux ! filesink location=recording.mp4 | ||
+ | |||
+ | Note: in order for the recording to be seekable, first you must do this: | ||
+ | |||
+ | # Set H.264 format (to enable codec controls) | ||
+ | v4l2-ctl -v pixelformat='H264' | ||
+ | |||
+ | # Set H.264 IDR frames (to allow seeking in recordings) | ||
+ | v4l2-ctl -c video_h_264_idr_period=1 | ||
+ | |||
+ | [[Category:2253|Rasp]] |
Latest revision as of 11:02, 4 June 2020
[edit] Compiling the 2253 driver on a Raspberry Pi board
Assuming Debian Raspbian installed, verify that build-essential and dkms packages are installed.
sudo apt-get install build-essential dkms
Choose one of the following methods to install the kernel headers:
- Install the kernel headers through apt (works as of 25 Mar 2019)
sudo apt install raspberrypi-kernel-headers
- Find out the version of the kernel using
uname -r
, then download and install headers package for version of kernel from https://www.niksula.hut.fi/~mhiienka/Rpi/linux-headers-rpi/
sudo dpkg -i ./linux-headers-4.1.18+_4.1.18+-2_armhf.deb sudo apt-get install -f
- Use the
rpi-source
command to install kernel source (recommended if the other option gives an error) See also: https://www.raspberrypi.org/forums/viewtopic.php?t=76261
sudo rpi-source
Compile the driver:
sudo make -C driver sudo make install
If the modprobe fails, the install step may have put the driver in the wrong modules directory if the kernel version has '+' at the end. Fix by doing:
sudo mv /lib/modules/4.1.18/extra /lib/modules/4.1.18+/ sudo depmod -a sudo modprobe s2253
Note: a better way may be to follow these instructions: http://billauer.co.il/blog/2013/10/version-magic-insmod-modprobe-force/
In order to use gstreamer, you may need to install the following packages:
sudo apt-get install gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-omx
Here is an example gstreamer command:
gst-launch-1.0 v4l2src device=/dev/video0 ! \ 'video/x-h264,standard=255,format=MP42,width=720,height=480,framerate=30000/1001,pixelformat=h264,profile=high' ! \ h264parse ! mpegtsmux ! filesink location=recording.mp4
Note: in order for the recording to be seekable, first you must do this:
# Set H.264 format (to enable codec controls) v4l2-ctl -v pixelformat='H264' # Set H.264 IDR frames (to allow seeking in recordings) v4l2-ctl -c video_h_264_idr_period=1