Introduction
After thinking about buying a Raspberry Pi for many years, I finally got around to buying a 3B+from thepihut.comThis page records my experiences and tips.
If anyone else finds them useful then Great!
If not, thanks for reading and please send me your tips.
Installation
nmap -sn 192.168.0.0/24
hostnane -I
http://qdosmsq.dunbar-it.co.uk/blog/2013/06/noobs-for-raspberry-pi/
Format an SD card which is 8GB or larger as FAT.
Download and extract the files from the NOOBS zip file.
Copy the extracted files onto the SD card that you just formatted, so that this file is at the root directory of the SD card.
[ Copy contents of extracted zip file, e.g. NOOBS_v2_8_1., to SD card]
https://www.raspberrypi.org/documentation/installation/noobs.md
Must Haves
To get the best from a Raspberry Pi I strongly recommend :- After some trial and error I STRONGLY recommend a Class 10 MicroSD card, e.g. I use SanDisk Ultra 80MBs MicroSD 32GB Memory Card Don't go lower than Class 10. You really need it for the Raspberry Pi desktop but can get away with a lower speed if exclusively using the terminal.
- Experience of using Linux as a user, e.g. Ubuntu, Mint, Suse, Red Hat. Particularly of using the bash shell.
- Installing omxplayer to play videos.
- Use the NOOBS Lite version (e.g. NOOBS_lite_v2_8.zip) to install the terminal only Linux version (bash shell).
- Use the NOOBS full version (e.g. NOOBS_v2_8_1.zip) to install the full Desktop version.
- Use Ctrl+Alt+F1-F6 to switch between terminals tty1 - tty6
https://www.howtogeek.com/111417/how-to-multitask-in-the-linux-terminal-3-ways-to-use-multiple-shells-at-once/ Use raspi-config to configure
https://www.raspberrypi.org/documentation/configuration/raspi-config.md
How To Change The Command Line Font Size
https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/http://www.stevencombs.com/raspberrypi/2016/05/18/change-terminal-font-size-raspi.html
sudo dpkg-reconfigure console-setup
https://unix.stackexchange.com/questions/77049/how-do-i-change-the-screen-font-size-when-using-a-virtual-console
sudo dpkg-reconfigure console-setup
#select "UTF-8"
#select "Guess optimal character set"
#select "Terminus"
#select 16*32 (my selection for a 7 inch monitor on raspberry pi)
sudo nano /etc/default/console-setup
You should edit the file /etc/default/console-setup and
change the FONTSIZE variable.
Once you've made your changes you must reconfigure your
terminal by running: sudo service console-setup restart
OR
sudo /etc/init.d/console-setup restart
https://askubuntu.com/questions/173220/how-do-i-change-the-font-or-the-font-size-in-the-tty-console/173221#173221
https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/
Software to Install
- omxplayer
- ufw
- gufw
- hfsprogs
- hfsutils
- hfsplus
- ntfs-3g
- exfat-fuse
- exfat-utils
- usbmount (configure with sudo nano
Use omxplayer in place of VLC, as omxplayer has dedicated Raspberry Pi 3B+ hardware support thereby making video decoding MUCH faster.
For omxplayer keys see https://www.raspberrypi.org/forums/viewtopic.php?t=13328 https://www.raspberrypi-spy.co.uk/2013/06/playing-videos-on-the-raspberry-pi-command-line
omxplayer ufw gufw hfsprogs hfsutils hfsplus ffmpeg ntfs-3g exfat-fuse exfat-utils ntfsdoc mpv mplayer ttf-mscorefonts-installer fonts-liberation fonts-liberation2 fonts-croscore fonts-arkpandora gufw mkvtoolnix mediainfo mc vlc fbi fim
--win "0 0 640 480"
https://raspberrypi.stackexchange.com/questions/24360/omxplayer-video-position-and-dimension
Setup a firewall
Use ufw or gufw firewallsudo apt-get install ufw
sudo apt-get install gufw
sudo ufw enable
sudo ufw allow 22
sudo ufw deny 22
https://help.ubuntu.com/lts/serverguide/firewall.html
Playing Audio files (e.g. AAC m4a)
omxplayer filename.m4a
+ or - = Up / Down Volume.
left or right arrow keys = backwards / forwards.
ffmpeg
https://ffmpeg.org/ffmpeg.htmlffmpeg -encoders | grep aac
aac
ffmpeg -encoders | grep h264
ffmpeg -decoders | grep aac
ffmpeg -decoders | grep h264
h264
h264_mmal
h264_vdpau
ffmpeg -encoders | grep h264_omx
libx264
libx264rgb
h264_omx
h264_vaapi
For decoding videos in FFMPEG use h264_mmal
For encoding videos in FFMPEG use h264_omx
ffprobe file.mp4 | less
DVD = 720 x 480
sudo apt-get update
sudo apt-get search ntfs
sudo ufw status
-c:v h264_omx
-c:v h264_mmal
-c:a copy
-c:a aac
ffmpeg -c:v
In this example :
ffmpeg -c:v h264_mmal -i inputfile.mp4 -c:v h264_omx -c:a copy -b:v 1500k outputfile.mp4
-c:v h264_mmal is used for decoding
-c:v h264_omx is used for encoding
https://trac.ffmpeg.org/wiki/Encode/AAC
https://trac.ffmpeg.org/wiki/Encode/H.264
This command encodes a video with good quality, using slower preset to achieve better compression:
ffmpeg -i input.avi -c:v libx264 -preset slow -crf 22 -c:a copy output.mkv
ffmpeg -i input -c:v libx264 -preset slow -crf 28 -c:a aac -b:a 128k output.mp4
Replace libx264 with h264_omx to achieve faster h.264 encoding, but at the expense of some quality (software encoders such as libx264 are generally of higher quality than more simplistic yet faster hardware encoders such as h264_omx ).
ffmpeg -i Mike06.mkv -movflags faststart -ss 0 -t 60 -c:v libx264 -crf 23 -profile:v baseline -level:v 3.1 -maxrate 3500k -bufsize 3500k -c:a aac -b:a 256k -ac 2 -ar 48000 -y h264test.mp4
h264_omx=14 MB
Baseline temperature = 48 C
Lowering the -crf from 23 to 20 (i.e. improving the quality) improves the video quality and results in a file size of 13.6 MB. The FFmpeg code runs at speed=0.589x and an overall bit rate of 1905kbits/s. Temperature peaked at 60.1 C.
Visually this is my preferred FFmpeg encoding, although it is much slower than the equivalent h264_omx encode.
For the h264_omx encode the figures were speed=1.21x and an overall bit rate of 1951kbits/s.
Temperature peaked at 52.6 C.
Running the same tests for the full 60 mins of the input video we have
libx264 -crf 20
max temp 63.4 speed=0.54x bitrate=1870kbps fps=13
filesize=810MB
h264_omx
max temp=52.6 speed=1.43x bitrate=2012kbps fps=36
filesize=872MB
Running the h264_omx encoder instead of the libx264 produces noticeably faster encoding times and a much cooler CPU. In the above example, which consisted of a teacher in front of a white board, obtained from a DVD, the above two ffmpeg examples produced broadly similar results - and certainly good enough for teaching purposes.
fbi
Frame Buffersudo apt-get install fbi
fbi -a -t 5 -u --readahead *
fbi --edit filename
then use r (90 clockwise), l (90 anti-clockwise).
File automatically saves with changes
Also consider from fim
fim xyz.jpg
fim is supposed be fbi improved.
https://www.raspberrypi-spy.co.uk/2014/09/how-to-display-images-on-raspbian-command-line/
ffmpeg Examples and Tips
The following examples use the Raspberry Pi inbuilt hardware h.264 video encoder and the Advanced Audio Codec (AAC) encoder.
Simple Version
ffmpeg -i input.mkv -c:v h264_omx -b:v 1750k -c:a aac -b:a 192k output.mp4Change -b:v 1750k to suit your required video quality and similarly -b:a 192k for audio quality, larger values are better quality (in bits).
Full Version
ffmpeg -i input.mkv -movflags faststart -c:v h264_omx -b:v 1750k -maxrate 3500k -bufsize 3500k -c:a aac -b:a 192k -ac2 -stats -y output.mp4ffmpeg -i input.mkv -movflags faststart -c:v libx264 -crf 16 -preset ultrafast -tune fastdecode -c:a aac -stats -y output.mp4
ffmpeg -i input.mkv -movflags faststart -ss 00 -t 30 -c:v libx264 -crf 16 -preset ultrafast -tune fastdecode -c:a aac -stats -y output.mp4
ffmpeg -i audio.aac -acodec mp3 -ac 2 -ab 160 audio.mp3
https://raspberrypi.stackexchange.com/questions/14268/converting-aac-to-mp3?rq=1
https://www.reddit.com/r/raspberry_pi/comments/5677qw/hardware_accelerated_x264_encoding_with_ffmpeg/
https://www.raspberrypi.org/forums/viewtopic.php?t=182960
https://maniaclander.blogspot.co.uk/2017/08/ffmpeg-with-pi-hardware-acceleration.html
https://raspberrypi.stackexchange.com/questions/3936/what-speed-can-i-expect-from-the-hardware-h264-encoding
https://mediaexperience.com/raspberry-pi-xbmc-with-raspbmc/
uname -a
sudo mount -t auto /dev/sda1 /media/pi/sda1
while true; do date; df -hm; sleep 10; clear; done
sudo alsa force-reload
sudo fdisk -l grep sd
cat /etc/mtab
cat /etc/fstab
mc (switch between windows with tab key)
5 commands to check memory usage on Linux
free
top
htop
while true; do free; sleep 5; done
~/fonts.conf
Temperature
Warning icons
https://www.raspberrypi.org/documentation/configuration/warning-icons.md
/opt/vc/bin/vcgencmd measure_temp
https://www.raspberrypi.org/forums/viewtopic.php?t=34994
while true; do /opt/vc/bin/vcgencmd measure_temp; sleep 5; done
Mount Mac HFS+
sudo apt-get install hfsprogs hfsutils hfsplus
sudo mount -t auto /dev/sdc /home/pi/sdc1
Note on my system
sudo fdisk -l
simply shows sdc not sdc1 but mounting still worked.
apt-get install ntfs-3g
and
apt-get install exfat-fuse exfat-utils
Network scan
ip addressnmap -sn 192.168.1.0/24