Skip to content

JayRugMan/fun_with_bash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fun with bash

This is a repository of random bash scripts, in addition to these lovely commands.

Webcam Stuff

Opening Local Webcam with dd and mplayer

see Maciej Piechotka's post here

dd if=/dev/video0 | mplayer tv://device=/dev/stdin
## OR ##
mkfifo videoCam
dd if=/dev/video0 of=videoCam &
mplayer tv://device=videoCam

Opening Local Webcam with VLC:

sudo apt update && sudo apt install vlc
cvlc v4l2:///dev/video0

Opening Local Webcam with mplayer

sudo apt update && sudo apt install mplayer
mplayer tv://device=/dev/video0

Streaming Remote Webcam in Terminal as ascii Video

see my post here

[me@myComp /some/dir]$ ssh someone@remoteComp
...
[someone@remoteComp /some/dir]$ cvlc v4l2:///dev/video0

Streaming Remote Webcam to mplayer

Just the live stream

see confetti's post here

[me@myComp /some/dir]$ sudo apt update && sudo apt install mplayer
[me@myComp /some/dir]$ ssh someone@remoteComp
...
[someone@remoteComp /some/dir]$ sudo apt update && sudo apt install ffmpeg
[someone@remoteComp /some/dir]$ exit
...
[me@myComp /some/dir]$ ssh someone@remoteComp "ffmpeg -hide_banner -r 14 -s 640x480 -f video4linux2 -i /dev/video0 -f matroska -" | mplayer - -idle
  • -hide_banner is what it says it is
  • -r is framerate
  • -s is size of window in pixels
  • -f is the format
  • -i is the input device

Again, but with tee for saving to a file as well

[me@myComp /some/dir]$ ssh someone@remoteComp "ffmpeg  -r 14 -s 640x480 -f video4linux2 -i /dev/video0 -f matroska -" | tee $(date +%Y-%m-%d_%H-%M-%S)_recording.mkv | mplayer - -idle

It also works with netcat:

# From remote machine
ffmpeg -hide_banner -r 14 -s 640x480 -f video4linux2 -i /dev/video0 -f matroska - | nc -l 12345

# from local machine
nc <remote machine IP> 12345 | mplayer - -idle

Whether using netcat or ssh, the delay was roughly 9 seconds. So, the benefit of netcat is bypassing ssh security, like odd ports and firewalls. Netcat worked without opening the port on either computer's firewall. However, netcat has to be started on the remote computer somehow...

About

This is a repository of random bash scripts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages