Linux video: Difference between revisions
Line 77: | Line 77: | ||
=== Openshot === |
=== Openshot === |
||
;Status: BAD |
|||
* Version 1.4.3 — Made a basic video edit (snip) and export. Works ok but has an annoying bug that video loses start time when editing properties [https://bugs.launchpad.net/openshot/+bug/1119897]. |
|||
* Version 2.3.4 — Video playback does not work. Stop playing after 2 or 3 sec. |
|||
;Install |
;Install |
||
The version distributed in Ubuntu repository is an old version (1.4.3) and has an annoying bug [https://bugs.launchpad.net/openshot/+bug/1119897]. Better install the latest version from dev PPA [http://www.openshot.org/ppa/]. |
The version distributed in Ubuntu repository is an old version (1.4.3) and has an annoying bug [https://bugs.launchpad.net/openshot/+bug/1119897]. Better install the latest version from dev PPA [http://www.openshot.org/ppa/]. |
Revision as of 18:11, 24 August 2017
Related Pages
- See Linux sound for Linux sound systems
- See Linux audio for audio support on Linux
- See Linux video for video support on Linux
- See Linux photo for photo support on Linux
Play videos
Mplayer
External links
Playing video files
MPlayer plays video files. Many video formats are supported. To play a file:
mplayer <SOMEFILE>
Here a short summary of keyboard shortcuts that can be used during playback:
Key | Function |
---|---|
Left Right | Forward / backward 10 seconds |
Down Up | Forward / backward 1 minutes |
PgDn PgUp | Forward / backward 10 minutes |
Some frequently-used options:
mplayer -xy 2 <SOMEFILE> # Plays a file with a scale factor of 2
Playing DVD's
Here some handy examples. Mplayer can also be used to play dvd files directly from the harddisk. Check man mplayer
for more examples.
mplayer dvd://1 # Quick start playing dvd from dvd-reader
mplayer dvd://5-7 # Only plays titles 5 to 7
mplayer dvd://1 -dvd-device /path/to/directory/ # Play DVD title 1 from a directory with VOB files
mplayer dvd://1 -alang fr -slang en # Play in Japanese with French subtitles
bug: There is apparently a bug that prevents subtitles to be displayed even though the option -slang is given on the command-line. As a workaround press the key J while playback to cycle through the subtitles.
Record video
SimpleScreenRecorder
SimpleScreenRecorder is a very simple and powerful tool to record desktop on Linux.
- Fullscreen - 128kb mp3, H.264 superfast setting
- Roughly 2Mbps for desktop recording. On i5-4300U CPU @ 1.90GHz, it takes 40% of one core.
VLC
We can use VLC to record the desktop, for instance to make Youtube tutorial videos.
- Go to Media → Convert/ Save
- Select the Capture Device tab
- Set Capture Mode to Desktop.
VLC foresee several profiles:
- H.264 + MP3 (.MP4 container).
- Roughly 1Mbps for desktop recording. On i5-4300U CPU @ 1.90GHz, it takes 95% of one core.
- Youtube SD.
- 640x480 - Roughly 1Mbps for desktop recording. On i5-4300U CPU @ 1.90GHz, it takes 40% of one core.
- Youtube HD.
- Issues
- VLC does not record audio
Encode video
HandBrake
See HandBrake.
Video Editor
Openshot
- Status
- BAD
- Version 1.4.3 — Made a basic video edit (snip) and export. Works ok but has an annoying bug that video loses start time when editing properties [1].
- Version 2.3.4 — Video playback does not work. Stop playing after 2 or 3 sec.
- Install
The version distributed in Ubuntu repository is an old version (1.4.3) and has an annoying bug [2]. Better install the latest version from dev PPA [3].
sudo add-apt-repository ppa:openshot.developers/ppa
sudo apt-get update
sudo apt-get install openshot-qt
Movie subtitles
Gnome Subtitles
Gnome Subtitles is an excellent application to generate, or resync subtitles file (format .srt...).
sudo add-apt-repository ppa:pedrocastro/ppa
sudo apt-get update
sudo apt-get install gnome-subtitles
Creating a ScreenCast
From [4]:
- Created an Intrepid instance in VirtualBox.
- Used gtk-recordmydesktop to record only the VirtualBox window.
- Create the intro and outro slides in OOo and recorded them using gtk-recordmydesktop.
- Import all three clips into Pitivi and exported them as a single ogv.
- Recorded the speech in Audacity while watching the screencast and exported it as a wav file.
- Converted the ogv to an avi using mencoder.
- Imported the avi and wav into avidemux, mashed them together and saved an avi.
- Used ffmpeg2theora to convert it back to an ogv.
Another solution: http://wiki.ubuntu.com/ScreencastTeam
Webcam
- Display webcam video stream with mplayer [5]:
mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0
How-To
Find duplicates
- Below (modified from https://ubuntuforums.org/showthread.php?t=1110498).
- Update: https://github.com/stueja/viddupes
#!/usr/bin/perl
use File::Path;
# Source: https://ubuntuforums.org/showthread.php?t=1110498
# Modified by Xeyownt
my $ofh = select STDOUT; #Make stdout hot
$| = 1;
select STDOUT;
$getimages = 1000; #render out 1000 images
$deletefirst = 300; #delete the first 300
$totalimages = $getimages - $deletefirst;
$minmatch = 2; #might use this later (not used now)
exit unless defined($ARGV[0]);
$searchdir = "$ARGV[0]"; #directory to scan
$searchdir = $searchdir . "/" unless $searchdir =~ m/\/$/;
$basedir = "/tmp/hashchecker/"; #working directory, this directory will get clobbered, make it something uniq in /tmp/
$basedir =~ s|/\z||;
print "Searching '$searchdir'...\n";
print "Cleaning up hsh directory '$basedir'...\n";
rmtree($basedir); #see, I told you.
print "Rendering $getimages frame(s), skipping the first $deletefirst. ($totalimages end result)\n";
@videofiles=`find "$searchdir" -type f -printf "%p\n" | grep -Ei "\.(mp4|flv|wmv|mov|avi|mpeg|mpg|m4v|mkv|divx|asf)"`;
foreach $i (@videofiles)
{
chomp $i;
print "Processing '$i'...";
@filename = split(/\//,$i);
$imgdir = $basedir . "/$filename[-1]";
mkpath($imgdir);
$data=`cd "$imgdir"; mplayer -really-quiet -vo png -frames $getimages -ao null "$i" 2>&1`;
@data=`find "$imgdir" -type f -name "*.png" | sort`;
for ($deletecount=0; $deletecount < $deletefirst; $deletecount++)
{
chomp $data[$deletecount];
unlink $data[$deletecount];
}
print "mogrify -resize 10x10! -threshold 50% -format bmp \"$imgdir/*\"\n";
$data=`mogrify -resize 10x10! -threshold 50% -format bmp "$imgdir/*"`;
$data=`find "$imgdir" -type f -name "*.png" -delete`;
print "\n";
}
print "Calculating hash table...\n";
@md5table=`find "$basedir" -type f -name "*.bmp" -exec md5sum "{}" \\; | sort | uniq -D -w32`;
foreach $x (@md5table)
{
chomp $x;
$x =~ m/^([0-9a-f]{32})/i;
$md5=$1;
$x =~ m/^[0-9a-f]{32}[ \t]*(.*)/i;
$fullpath=$1;
@filename = split(/\//,$x);
open (MYFILE, ">>$basedir/$md5.md5") or die "couldnt open file\n";
print MYFILE "$fullpath\n";
close (MYFILE);
}
@hashfiles=`find "$basedir" -type f -name "*.md5"`;
foreach $i (@hashfiles)
{
chomp $i;
@uniqfiles=`sort "$i" | uniq`;
$uniqsize=@uniqfiles;
if ($uniqsize > 1)
{
$firstpass = 1;
foreach $x (@uniqfiles)
{
chomp $x;
@filename=split(/\//,$x);
if ($firstpass == 1)
{
$outfile=$filename[-2];
$firstpass=0;
}
else
{
if ($outfile ne $filename[-2])
{
open (COUNTFILE, ">>$basedir/$outfile.count") or die "$outfile -> couldnt open file\n";
print COUNTFILE "$filename[-2]\n";
close (COUNTFILE);
}
}
}
}
}
print "Here come the delicious dupes:\n";
@hashfiles=`find "$basedir" -type f -name "*.count"`;
foreach $i (@hashfiles)
{
chomp $i;
print "$i\n";
@uniqfiles=`sort "$i" | uniq -c`;
foreach $x (@uniqfiles)
{
chomp $x;
$x =~ m/^[ \t]*([0-9]{1,50})/i;
$percent = $1/$totalimages*100;
$x =~ m/^[ \t]*[0-9]{1,50}(.*)/i;
$filename=$1;
printf "\t%.2f% match with %s\n",$percent,$filename;
}
print "\n";
}
exit;
Create video thumbnails
ffmpegthumbnailer
Requires ffmpegthumbnailer:
THUMBDIR=thumbnails
THUMBSUMMARY=summary.png
make_thumbnails()
{
if [ -d $THUMBDIR ]; then
mv $THUMBDIR $THUMBDIR-$(date +"%Y%m%d%H%M%S")
fi
# sudo apt install ffmpegthumbnailer
SIZE=512
mkdir -p "$THUMBDIR"
i=0
for f in *; do
[ "$f" = "$THUMBDIR" ] && continue
echo -- "$f"
ffmpegthumbnailer -s $SIZE -i "$f" -o "$THUMBDIR/$f-10.png" -c png -t 10
ffmpegthumbnailer -s $SIZE -i "$f" -o "$THUMBDIR/$f-20.png" -c png -t 20
((i++))
# [ $i -lt 5 ] || break
done
echo "Doing montage..."
montage -label %f -frame 5 -geometry "$SIZEx$SIZE+2+2>" $THUMBDIR/*.png $THUMBSUMMARY
mv $THUMBSUMMARY $THUMBDIR/
}
Note that the thumbnail summary can be quite big. Use viewer like feh to view it. The same application can be used to view thumbnails easily:
THUMBDIR=thumbnails
THUMBSUMMARY=summary.png
view_thumbnails()
{
# sudo apt intall feh
feh -dF --zoom fill $THUMBDIR
}
view_thumbnails_summary()
{
# sudo apt intall feh
feh $THUMBDIR/$THUMBSUMMARY
}
ffmpeg
ffmpeg -itsoffset -5 -i "$srcimg" -vcodec mjpeg -vframes 1 -an -f rawvideo -s 200x200 -loglevel quiet "$dest"