Listing posts

Displaying posts 26 - 30 of 328 in total
Concatenate video files
mouse 1811 · person cloud · link
Last update
2023-12-11
2023
12-11
«ffmpeg, mplayer/mencoder
join video files»

Use either of these commands to concatenate video files with the same codec and dimensions:

1
2
3
4
5
# mencoder
mencoder -oac copy -ovc copy -idx -o out.avi in*.avi

# ffmpeg
ls in*.avi | sed 's/.*/file \0/' | ffmpeg -f concat -c copy -i - out.avi

Check video resolutions:

1
2
3
4
5
6
for i in *.mp4; do
  echo -en "$i\t"
  ffprobe -v error -select_streams v:0 \
   -show_entries stream=width,height \
   -of csv=s=x:p=0 "$i"
done

To concatenate video files with different codecs and/or dimensions you have to reencode all files choosing common codecs/dimensions:

1
mencoder -oac mp3lame -ovc x264 -idx -vf expand=640:640 -o out.avi in*.avi

Source: FFmpeg / ffmpeg@stackoverflow, Mencoder


~~~ * ~~~

Listen to radio FM/DAB with RTL2832U
mouse 1812 · person cloud · link
Last update
2023-12-01
2023
12-01
« — »
1
2
# /etc/udev/rules.d/10-local_rtl-sdr.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d3", GROUP="audio", MODE="0666", SYMLINK+="rtl-sdr"
1
2
# reload udev and plug the usb RTL2832U stick
udevadm control --reload-rules && udevadm trigger

FM

Using cubicsdr FM app (GUI):

1
2
apt install cubicsdr
CubicSDR

Using rtl-sdr:

1
2
3
4
apt install rtl-sdr

# play a FM radio station at freq. 107300000Hz with 6x sampling
rtl_fm -f 107.30e6 -M wbfm -s 200000 -r 48000 - | aplay -r 48000 -f S16_LE

DAB

Using welle.io:

1
2
3
apt install welle.io
welle-io # GUI
welle-cli -c 7D -p R101

Using dablin + dabtools/eti-cmdline:

1
2
3
4
5
6
7
8
9
10
# compile dabtools
git clone https://github.com/Opendigitalradio/dabtools.git && cd dabtools
mkdir -p mybuild && cmake -DCMAKE_BUILD_TYPE=Release -S . -B mybuild
cmake --build mybuild
find -type f -executable mybuild
mv mybuild/src/dab2eti mybuild/src/eti2mpa ~/bin/

# dablin
apt-get install dablin
dablin -D dab2eti -d ~/bin/dab2eti -c 12C -l R101

Using terminal-DAB-xxx:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
apt-get install \
  git cmake build-essential g++ pkg-config libsndfile1-dev libfftw3-dev portaudio19-dev zlib1g-dev  libusb-1.0-0-dev libsamplerate0-dev ncurses-base \
  libfaad-dev librtlsdr-dev

git clone https://github.com/JvanKatwijk/terminal-DAB-xxx.git

cd terminal-DAB-xxx
mkdir build && cd build
cmake .. -DRTLSDR=ON -DFAAD=ON -DPICTURES=OFF
make
mv terminal-DAB-rtlsdr t-dab && strip t-dab

# http://www.air-radio.it/T_DAB.html
# 12A  EuroDAB     http://www.litaliaindigitale.it/radio-dab/mux-eurodab-italia
# 12C  DAB Italia  https://www.dab.it
# 12D  DAB+ RAI    http://www.rai.it/dl/DigitalRadio/dab_raiway.html
./t-dab -Q -C 12C -S R101  # play service "R101" on channel "12C" with autogain

See also: opendigitalradio.org, Qt-DAB app


~~~ * ~~~

Setup RetroPie gaming station attachment
mouse 7773 · person cloud · link
Last update
2023-11-30
2023
11-30
«raspi»

< repos | installer | docs | forum >

Setting up RetroPie

  • Check your locale settings with the locale command:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
pi$ locale | sort
LANG=en_GB.UTF-8
LANGUAGE=
LC_ADDRESS="en_GB.UTF-8"
LC_ALL=
LC_COLLATE="en_GB.UTF-8"
LC_CTYPE="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"

and set missing values in /etc/environment:

1
2
LANGUAGE="en_GB:en"
LC_ALL="en_GB.UTF-8"
  • Login as pi, clone the setup script and run it:
1
2
3
git clone --depth=1 https://github.com/RetroPie/RetroPie-Setup.git ~/RetroPie-Setup
cd ~/RetroPie-Setup
sudo ./retropie_setup.sh

do a Basic Install and disable the splashscreen in Configuration to avoid a suddend switch to VT1 after the graphical login (see reddit Q/A and retropie faq).

  • Disable screenblanker by appending consoleblank=0 to kernel parameters in /boot/cmdline.txt.

  • Set memory split for the video card to at least 128MB via raspi-config.

  • Create a shortcut to launch EmulationStation from the Pixel desktop (or use the alacarte menu editor):

1
2
3
4
5
6
7
8
9
# ~/.local/share/applications/retropie.desktop
[Desktop Entry]
Type=Application
Name=RetroPie
Comment=Retro video game emulators
Exec=/home/pi/bin/start-retropie
Icon=/path/to/retropie.png
Terminal=false
Categories=Application;Game;

create the /home/pi/bin/start-retropie:

1
2
3
4
5
6
7
8
#!/bin/sh
# release the video card and switch to the 1st foreground virtual terminal
sudo /path/to/ttyecho -n /dev/tty1 \
  "sudo systemctl stop lightdm ; " \
  "sleep 1 ; " \
  "chvt 1 ; " \
  "emulationstation --debug > /run/shm/ra.log 2>&1 ; " \
  "sudo systemctl start lightdm"

then compile and install the ttyecho program (see attachment).

Note: Make sure you have enabled console autologin on VT1 via raspi-config.

  • Optionally you can configure runcommand to show a game splashscreen by enabling Launch Menu Art in its configuration, and even set a system default image by installing the experimental package launchingimages.

  • Show scanlines:

    • Configuration > Retroarch > Enable shaders and overlays
    • Configuration > Configedit > Configure basic libretro emulator options > Configure default options for all libretro emulators > Video shader enable and Video shader file > crt-pi.glslp
  • When configuring controller you can skip buttons you don't have by simply long press a button.

  • Setup video mode:

Set your tv/monitor format by setting sdtv_mode=2 (PAL) in /boot/config.txt.

Set the low resolution VGA mode CEA-1 by putting in /opt/retropie/configs/all/videomodes.cfg:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
mame4all = "CEA-1"
mupen64plus = "CEA-1"
pifba = "CEA-1"
lr-beetle-ngp = "CEA-1"
lr-beetle-pce-fast = "CEA-1"
lr-beetle-supergrafx = "CEA-1"
lr-caprice32 = "CEA-1"
lr-fbalpha = "CEA-1"
lr-fceumm = "CEA-1"
lr-fuse = "CEA-1"
lr-gambatte = "CEA-1"
lr-genesis-plus-gx = "CEA-1"
lr-gpsp = "CEA-1"
lr-handy = "CEA-1"
lr-mame2000 = "CEA-1"
lr-mame2003 = "CEA-1"
lr-mgba = "CEA-1"
lr-mupen64plus = "CEA-1"
lr-nestopia = "CEA-1"
lr-pcsx-rearmed = "CEA-1"
lr-picodrive = "CEA-1"
lr-prosystem = "CEA-1"
lr-quicknes = "CEA-1"
lr-snes9x2002 = "CEA-1"
lr-snes9x2005 = "CEA-1"
lr-snes9x2010 = "CEA-1"
lr-stella = "CEA-1"
lr-vba-next = "CEA-1"
lr-vecx = "CEA-1"

in this manner your TV will do the upscaling work and the emulators will run faster.

Upgrading RetroPie version

1
2
3
cd ~/RetroPie-Setup
git pull
sudo ./retropie_setup.sh # and choose "Update" from the menu

Note: When the upgrade is finished make sure the splashscreen is disabled.

Scraping game images

  • Install Skyscraper in the experimental packages
  • Customize game aliases in ~/.skyscraper/aliasMap.csv
  • Import your custom JPG/PNG images by placing them in ~/.skyscraper/import/<covers|screenshots|wheels> with the same name as your roms

PlayStation tips (lr-pcsx-rearmed)

  • Use this script to rip your own original PSX cd-rom discs:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env ruby
require 'shellwords'

dev   = '/dev/dvd'
title = ARGV[0].strip
vol   = `volname #{dev}`.strip
vol   = 'NO-LABEL' if vol.size == 0
puts "#{vol} - #{title}\n\n"

system "cdrdao read-cd --read-raw --read-subchan rw_raw --datafile #{title.shellescape}.bin --device #{dev} --driver generic-mmc-raw #{title.shellescape}.toc" # 2>&1 | tee #{title.shellescape}.log

system "eject #{dev}" if $?.to_i == 0

# add comment
lines = File.read("#{title}.toc").split("\n")
lines.insert(2, "// #{vol} - #{title}")
File.open("#{title}.toc",'w'){|f| f.puts lines }

# update m3u
if title =~ /^(.+) \(CD(.)\)$/
  File.open("#{$1}.m3u", 'a'){|f| f.puts "#{title}.toc"}
end

#toc2cue $vol.toc $vol.cue # optional

if using a different program that creates multiple bin files then you can merge them via binmerge

  • File extensions: bin/img + toc/cue + sbi (image, descr, subchannel)

  • Multidisc howto:

1
2
3
4
5
6
7
8
9
10
# files in Retropie/roms/psx folder:
.multidisc/Title (CD1).bin
.multidisc/Title (CD1).toc
.multidisc/Title (CD2).bin
.multidisc/Title (CD2).toc
Title.m3u

# Title.m3u file contents:
.multidisc/Title (CD1).toc
.multidisc/Title (CD2).toc

Setup an arcade controller via xboxdrv

Install xboxdrv from retropie_setup.sh, customize and run the command without --silent --daemon --detach options and test the new virtual controller with jstest /dev/input/js0, then put it in /etc/rc.local:

1
2
3
4
5
6
/opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
  --detach-kernel-driver \
  --silent --daemon --detach --pid-file /run/xboxdrv.pid \
  --device-by-id 045e:028e --type xbox360 \
  --trigger-as-button --dpad-only \
  --device-name "DragonSlay Arcade DGSAK17"

and create a new dbus rule in /etc/dbus-1/system.d/org.seul.Xboxdrv.conf:

1
2
3
4
5
6
7
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
  <policy context="default">
    <allow own="org.seul.Xboxdrv"/>
  </policy>
</busconfig>

See also:

Raspberry Pi4 tips


Source: RetroPie HP, wired, Pixel & RetroPie, RP icon, TTYecho, change linux vt/tty

Retropie docs: Wiki, Manual install, RA hotkeys, Controller setup, Supported systems, Arcade HP & MAME info

PlayStation 1: convert ISO to PBP format on windows and linux -- see gtk-popstation and psx2psp/popstation by Ivan Vega

MAME resources: Snapshots, DAT/XML files, game lists by genre, ES gamelist.xml script

Game systems DAT/XML files: HyperList


TODO/WIP:


~~~ * ~~~

How do I build a CMake project
mouse 204 · person cloud · link
Last update
2023-11-29
2023
11-29
« — »
1
2
3
4
5
md -p mybuild && cmake -DCMAKE_BUILD_TYPE=Release -S . -B mybuild

cmake --build mybuild

find -type f -executable mybuild

Source: stackoverflow


~~~ * ~~~

Linux Run Command As Another User
mouse 192 · person cloud · link
Last update
2023-11-29
2023
11-29
«runuser, su, sudo»

runuser

Only root can use it, no password asked, less overhead than others.

1
2
3
4
5
runuser -u username -- command args

# -l = login shell, -P = allocate a pty
runuser -l  userNameHere -c 'command args'
runuser -P -l  userNameHere -c '/user/bin/bash -ilc "command args"'

Note: You can also use #!/usr/bin/env -S bash -il shebang in a command script to get the real final user environment.

sudo

Asks user password.

1
2
3
# -i = login shell, -u = username
sudo -iu username # open default shell for `username`
sudo -iu username command args

su

Asks target password.

1
2
3
# - or --login = login shell
su - # open root shell
su - username -c "command args"

Source: nixCraft