jpg_to_mjpegtools_yuv is a program that will take a series of jpg pictures,
and convert those to a mjpeg tools YUV format output stream via stdout.
Both BW and color jpegs are supported, all pictures must be the same size.
The following script will create suitable pictures from almost any format jpgs,
then either sends a stream over the LAN, or creates an AVI file that can be played with mplayer.
(As to mplayer, it will not display the last picture... bug? so perhaps add the last picture again as one higher number).
# jpg_to_avi_slideshow for bash
#
# how long to show a single jpg.
SECONDS_PER_PICTURE=7
# Geometry of AVI movie or stream.
GEOMETRY=800x480
# Where to send the stream
EEEPC_IP=10.0.0.155
EEEPC_PORT=1234
echo "Usage: jpg_to_avi_slideshow [filename.avi]"
# Create temp directory, pictures for ffmpeg go here
mkdir qtemp 2>/dev/zero
echo "erasing old xxxx.jpg"
rm qtemp/*
count=1
for i in *.jpg
do
echo "converting $i"
convert -geometry $GEOMETRY -extent $GEOMETRY $i qtemp/$count.jpg
let count=count+1
done
if [ "$1" = "" ]
then
cd qtemp
echo "creating and streaming avi to IP $EEEPC_IP port $EEEPC_PORT, ctrl C to stop"
jpg_to_mjpegtools_yuv -s $SECONDS_PER_PICTURE | netcat $EEEPC_IP $EEEPC_PORT
cd ..
else
cd qtemp
echo "creating $1"
jpg_to_mjpegtools_yuv -s $SECONDS_PER_PICTURE > $1
mv $1 ../
cd ..
echo "deleting temp files"
rm qtemp/*
echo "deleting temp directory"
rmdir qtemp
echo "ready"
fi
exit 0
In case of sending via a LAN, for example via WiFi,
all that needs to run on the receiving eeePC (or any Linux computer, but with its own monitor aspect value)
is this script 'listen-ts' (crtrl alt T starts an xterm on the eeePC):
EEEPC_PORT=1234
while [ 1 ]
do
# ./listen-ts
echo "Hold ctrl C down to abort."
netcat -l -p $EEEPC_PORT | mplayer -fs -vop pp=0x20000 -monitoraspect 800:480 -cache 1000 -
done
exit 1
The script will also work if you netcat satellite TV transport stream, or audio wave files, or mp3 files, anything mplayer wants to display.
Example sending a compressed DivX AVI:
jpg_to_mjpegtools_yuv -s 10 | ffmpeg -f yuv4mpegpipe -i - -f avi -vcodec xvid -b 10 -r .1 -g 1 -y /dev/stdout | netcat 10.0.0.155 1234
Or to an AVI file:
jpg_to_mjpegtools_yuv -s 10 | ffmpeg -f yuv4mpegpipe -i - -f avi -vcodec xvid -b 10 -r .1 -g 1 -y q7.avi
How I made my slideshow:
Video:
In the directory where all jpgs I want to use are copied to:
jpg_to_avi_slideshow slideshow.yuv
Audio:
All mp3 must be same format, use cdparanoia to get wave format from CD, and then lame to convert to mp3:
mpgedit -o slideshow.mp3 -e- track1.mp3 track2.mp3 track.mp3 track4.mp3 track.mp3
Combine to DivX avi (note -b 30 = 30 kbps, use higher for better quality):
ffmpeg -i slideshow.mp3 -i slideshow.yuv -vcodec xvid -b 30 -r .1 -g 1 -y slideshow.avi
Pipe to eeePC (as photo frame you may have eeePC sound off):
while [ 1 ] ; do cat big_slideshow.avi | netcat 10.0.0.155 1234; sleep 10; done