convert avi (or mpg or mkv or m2ts) to MP4 to save disk space
To convert avi files to mp4 use the ffmpeg command, you may need to install it.
sudo apt-get install ffmpeg # debian-ubunutu distros - LINUX MINT MATE recommended
avi files are roughly 43% larger than the same file as mp4 - this may vary greatly on the content and quality.
after converting avi, mpg, mkv and m2ts videos to MP4, the following reductions were seen:
m2ts-mp4 23%
avi-mp4 43%
mkv-mp4 49%
mpg-mp4 70%
---------------------------------------
COMMAND:
ffmpeg -i FILE.avi FILE.mp4
---------------------------------------
FFMPEG steps to convert avi to mp4
---------------------------------------
1) list avi into file; edit using vim (or vi)
2) replace lines with the following string:
hit and then this sequence:
:2,$s$.*$ffmpeg -i & &-X.mp4 ; rm -f & $g
3) then replace -X.mp4 with .mp4
hit and then this sequence:
:%s/.avi-X.mp4/.mp4/g
hit :wq
4) run file as script or copy by line
(chmod 744 filename,
then the type filename
(IF your path has "." or ~/ )
or type "sh ./filename"
---------------------------------------
NOTE: Grabbed viminfo details for process above:
cp ~/.vinfo viminfo-to-edit; vi viminfo-to-edit
(note in .bashrc either alias vi to vim or define editor as vim, seen .bashrc details)
# This viminfo file was generated by Vim 8.1.
# Last Substitute String:
# Command Line History (newest to oldest):
found strings and copied them above... considerable history in ~/.viminfo
viminfo is not always installed by default:
sudo apt-get -y install vim # again, LINUX MINT MATE or other debian based distros
# ================================================================================
# ffmpeg --help short string:
# usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
# options are complex, simple always works
# abbreviated and simple usage: ffmpeg -i infile outfile
# ================================================================================
# ffmpeg -i input_X.avi output_X.mp4
# WORKED: ffmpeg -i 09x00_Special_The_Making_of_Back_To_Earth.avi The_Making_of_Back_to_Earth.mp4
# 243,677,198 (232.39mb) --> 102,953,111 (98.18mb)
# ================================================================================
NOTICE FILE DIFFERNCE (renamed file), 233M --> 99M (about 43% smaller with this file):
-rw-r--r-- 1 john john 233M Jul 26 19:47 09x00_Special_The_Making_of_Back_To_Earth.avi
-rw-r--r-- 1 john john 99M Aug 12 20:49 The_Making_of_Back_to_Earth.mp4
JohnMeister.com Today's Date:
|