I am looking for a way that I can place a handful of mixed images (JPG) and videos (AVI?, MP4?) in a directory and loop through them continuously, in full screen, creating a slideshow from the images and playing the videos. I do require the ability to add and remove files from that directory, and have the outputting show reflecting the changes. Transition effects would be nice, but are not required. A little bit of Bash or Python scripting would be fine, but I would like to avoid a full custom software.
Ubuntu – Slideshow and video application
software-recommendationvideo
Related Solutions
You can try imagination from the repository.
sudo apt-get install imagination
Imagination is a lightweight and user-friendly DVD slide show maker with a clean interface and few dependencies. It only requires the ffmpeg encoder to produce a movie to be burned with another application.
It currently features over 50 transition effects. Exporting the slideshow in FLV format is supported as well.
Preliminary Steps
Launch VLC with vlc -vvv
. This turns on verbosity to 2 (debug)
. This can also be seen in VLC GUI by going to Tools > Messages. Then follow the steps listed above in the screen shots to display the needed information for the command in the debug log. Then you can adjust the appropriate syntax by looking at the script below and online. You can also see the code and syntax by selecting Show more options. (The first screenshot in my question above.) However, this is only how I was able to create the cvlc command below. You may simply want to adjust the below script to your needs.
Initially, I was unable to get the audio to work with the one RCA audio port on my camcorder. I fixed this by going to Tools > Preferences > All (radio button, bottom left). Then I went to Input / Codecs > Access modules > ALSA. I changed the Sample rate to 48000 Hz. After changing this setting you will be able to stream your video. The other sample rates were causing an error.
Go to Media > Open Capture Device. Select Video device name and Audio device name (note that in the screen shot above it is default because I was using the microphone port instead. Yours will be different if you're using the RCA connection on your Hauppauge device.) Select NTSC (or whatever format your video tapes are). Click Play. While playing, go to Tools > Codec Information. You will want to adjust the below script according to the information given there. I adjusted the frame rate to 29.97 and sample rate to 48000 Hz. in my script because of the information given there.
About the Script
a. You are prompted to input the filename and metadata. Files are set to save to ~/Videos.
b. VLC (cvlc)
- I set the timeout to 122 minutes because my 8mm tapes are two hours. The
--foreground
option allows you to hit 'ctrl c,' and it will stop only this portion of the script and continue to the next part. (Some videos I have are shorter.) - You can use VLC GUI to find the audio and video device names. (See the above screenshot.)
- Know whether your video is NTSC or another format.
vcodec
andacodec
are set set tompeg2
andmpga
. The Amazon product page for the Hauppauge 610 states that it encodes to MPEG-2.- For MPEG-2, VLC GUI only gave the option for .ts format. (See second screenshot above.) Therefore I am using
mux=ts
. Initially I was usingvcodec=h264
acodec=mpga
andmux=mp4
. However, there were audio sync issues and the sound would drop out at certain places in the video. Also see the mux= section here. - I needed
samplerate=48000
for it to work. - The frames per second given on the Codec Information were 29.97. This is standard for VHS / 8mm tapes. Therefore, I decided to match it.
- I chose to deinterlace. I thought this looked better.
- Using
mux=ts
will create a large file. My two hour videos are 5-7 GB.
c. FFmpeg compresses further with libx264 (from about 5 GB to about 1.5 GB) and adds in the metadata. There were additional handwritten notes about each 8mm tape and I wanted to include this additional information with the file. In the same command, FFmpeg moves left channel audio from only left to both left and right channels as a stream copy with no additional audio compression. My camcorder has only one RCA audio port. So this fixes the one speaker issue. Thanks to mondaugen for their answer on the one-channel audio issue.
d. Lastly, you are notified when the script finishes. For my personal script, I am actually using the following instead.
On my computer:
exo-open --launch WebBrowser $HOME/Videos/video-finished.htm
File contains: <p style="font-size: 128px; color: green; font-family: sans; text-align: center; margin-top: 10%; font-weight: bold;">VIDEO FINISHED</p>
On my phone:
You can install gcalcli
to receive a notification on your phone via Google Calendar when the script completes. Below, the date and time for two minutes in the future is put into a variable. Then a calendar entry is created for that time. A reminder is set for the start of that event. Google Calendar needs a two minute buffer. (I tried one minute.) So, you would be notified two minutes after the encode finishes.
new_date=`date --date="2min"`
gcalcli --calendar 'Name of Your Calendar' --title 'Video Finished' --where '' --when \'"$new_date"\' --duration 5 --description '' --reminder 0 add
End Product
The final result produces the larger .ts file and a further compressed .mp4.
CPU Usage
I have an AMD A8-6500B processor. cvlc
runs at about 15% cpu usage. However, ffmpeg
was running at about 97%. Therefore, in my script (not in the one below), I added the -threads 3
option to keep CPU usage at an overall 75%. I am able to do this because my processor is quad core.
#!/bin/bash
# Name: Hauppauge 610 USB-Live 2 Analog Video Digitizer and Video Capture Device Conversion Script
# Author: jbrock
# Dependencies: VLC media player; ffmpeg, in Ubuntu you will need to add a ppa to install.
# License: GNU GPLv3 (http://www.gnu.de/documents/gpl-3.0.en.html)
# Usage: Digitize analog tapes to .ts format. Then convert to mp4, add metadata, and make sound work on left and right channels.
# Enter the name of the file.
echo -n "Enter file name: "
read archivo
# This is for metadata. It will show up in the media player playlist or after clicking Properties (in OS X Info) on the file context.
echo -n "Enter a description: "
read comentarios
# Encode video and stop after 122 minutes. The foreground option allows you to hit 'ctrl c,' and it will only stop this portion of the script.
timeout --foreground 122m cvlc v4l2:///dev/video0 :input-slave=alsa://hw:2,0 :v4l2-standard=NTSC :live-caching=300 --sout '#transcode{vcodec=mpeg2,acodec=mpga,ab=128,channels=2,samplerate=48000,fps=29.97,deinterlace}:std{access=file{no-overwrite},mux=ts,dst='$HOME/Videos/$archivo.ts'}'
# Convert to H.264 to compress further, add in the metadata comments, and make output from the left speaker to both speakers.
ffmpeg -i $HOME/Videos/$archivo.ts -c:v libx264 -preset medium -crf 22 -metadata comment="$comentarios" -af "pan=mono|c0=FL" $HOME/Videos/$archivo.mp4
# Show the 'finished' message.
notify-send "VIDEO FINISHED"
Best Answer
VLC does that. You can open a directory as media source through Media > Open Directory, all items in there will show up under the My Computer item. Select them all and click play; by default pictures are shown for 10 seconds.