π
2024-11-17 01:01
in Linux
This is for linux, using mplayer because it was written many years ago before ffmpeg was a proper option. It parses mplayer video file decoding to rename filenames with the proper codec and file container.
The script: https://marc.merlins.org/linux/scripts/vidrename
Possible video containers supported by this script
*.mpeg (original mpep1/mpeg2 from the '90s)
*.rm (very old realaudio/realvideo from the 90's)
*.mov (old apple quicktime container, also from 90's)
wmv (old video media player, still from 90's)
avi (newer-ish video media)
mp4 (for a while new format used by most videos)
ogv (Org Vorbis OSS format, now obsolete)
mkv (free open source container to get around mp4 patents and royalties)
webm (newer free/open source container)
The script does not bother to show old/obsolete codecs for WMV/AVI (you can add support if you care), and concentrates on only showing some more popular formats over the years that I cared more about:
divx3.avi
divx4.avi
divx5.avi
xvid.avi
H264.mp4 (for a while the most popular format after divx5/divx4/divx3)
H265.mp4 (the more efficient version of H264, but the patent/royalties fees on it are way high)
VP9.mp4 / VP4.webm (meant to replace H264 and H265 with more efficient and free version)
AV1.mp3 / AV1.webm (newer versino of VP9, still open source and free)
This is what it looks like
sauron [mc]$ l
total 15148
drwxr-sr-x 1 merlin merlin 188 Nov 17 19:32 .
drwxr-sr-x 1 merlin merlin 184 Nov 17 19:32 ..
-rw-r--r-- 1 merlin merlin 2453715 Nov 17 19:31 file1.mp4
-rw-r--r-- 1 merlin merlin 1572011 Nov 17 19:31 file2.mp4
-rw-r--r-- 1 merlin merlin 1734137 Nov 17 18:25 Out16_av1.mp4
-rw-r--r-- 1 merlin merlin 1433362 Nov 17 18:29 Out16a_vp9.mp4
-rw-r--r-- 1 merlin merlin 827673 Nov 17 18:35 Out16c_vp9.mp4
-rw-r--r-- 1 merlin merlin 1449311 Nov 17 18:26 Out16_vp9.mp4
-rw-r--r-- 1 merlin merlin 3496280 Nov 17 18:22 Out_av1.mp4
-rw-r--r-- 1 merlin merlin 2527312 Nov 17 18:20 Out_vp9.mp4
sauron [mc]$ vidrename --noinfo *
Going from file1.mp4
to File1 - H265.mp4
Going from file2.mp4
to File2 - VP9.mp4
Warning for Out16_av1.mp4, webm != mp4
Going from Out16_av1.mp4
to Out16 av1 - AV1.webm
Warning for Out16a_vp9.mp4, webm != mp4
Going from Out16a_vp9.mp4
to Out16a vp9 - VP9.webm
Warning for Out16c_vp9.mp4, webm != mp4
Going from Out16c_vp9.mp4
to Out16c vp9 - VP9.webm
Warning for Out16_vp9.mp4, webm != mp4
Going from Out16_vp9.mp4
to Out16 vp9 - VP9.webm
Warning for Out_av1.mp4, webm != mp4
Going from Out_av1.mp4
to Out av1 - AV1.webm
Warning for Out_vp9.mp4, webm != mp4
Going from Out_vp9.mp4
to Out vp9 - VP9.webm
sauron [mc]$ l
total 15148
drwxr-sr-x 1 merlin merlin 298 Nov 17 19:32 .
drwxr-sr-x 1 merlin merlin 184 Nov 17 19:32 ..
-rw-r--r-- 1 merlin merlin 2453715 Nov 17 19:31 'File1 - H265.mp4'
-rw-r--r-- 1 merlin merlin 1572011 Nov 17 19:31 'File2 - VP9.mp4'
-rw-r--r-- 1 merlin merlin 1734137 Nov 17 18:25 'Out16 av1 - AV1.webm'
-rw-r--r-- 1 merlin merlin 1433362 Nov 17 18:29 'Out16a vp9 - VP9.webm'
-rw-r--r-- 1 merlin merlin 827673 Nov 17 18:35 'Out16c vp9 - VP9.webm'
-rw-r--r-- 1 merlin merlin 1449311 Nov 17 18:26 'Out16 vp9 - VP9.webm'
-rw-r--r-- 1 merlin merlin 3496280 Nov 17 18:22 'Out av1 - AV1.webm'
-rw-r--r-- 1 merlin merlin 2527312 Nov 17 18:20 'Out vp9 - VP9.webm'
Other example uses:
sauron [mc]$ vidrename --help
Unknown option: help
/var/local/scr/vidrename [--fixepisodes] [--verbose] [--extonly] [--dots] [--spacedash] [--spaces2dash] [--ucname [num]] [--add text] [--noinfo] [--writetofile] [--norename] [--addfps]
--extonly: only fix file extension, do not beautify filename
--dots: remove all dots from filenames ane replace with spaces
--spacedash: add spaces around all dashes if not already present (only one by default) (IGNORED, ON BY DEFAULT)
--spaces2dash: replace all spaces with dashes
--fixepisodes: normalize showname - 1x01 episodename.ext
--ucname: number of letters in a word before we uppercase the first (default 3) (IGNORED)
--add: add random text before the extension
--noinfo: do not add file info to filename ( - XxY - z kbps)
--writetofile: do not add fileinfo to filename, write to a different file
--norename: only print what would be done, do not rename files
--addfps add fps of video to filenames
sauron [mc]$ vidrename --spaces2dash --addfps *
Going from File1_-_H265_-_H265.mp4
to File1_-_H265_-_1920x1080_-_2974kbps_-_30.000_fps_-_H265.mp4
Going from File2_-_VP9_-_VP9.mp4
to File2_-_VP9_-_1920x1080_-_1861kbps_-_60.000_fps_-_VP9.mp4
Going from Out16_av1_-_AV1_-_AV1.webm
to Out16_av1_-_AV1_-_1920x1080_-_30.000_fps_-_AV1.webm
Going from Out16a_vp9_-_VP9_-_VP9.webm
to Out16a_vp9_-_VP9_-_1920x1080_-_30.000_fps_-_VP9.webm
Going from Out16c_vp9_-_VP9_-_VP9.webm
to Out16c_vp9_-_VP9_-_1920x1080_-_30.000_fps_-_VP9.webm
Going from Out16_vp9_-_VP9_-_VP9.webm
to Out16_vp9_-_VP9_-_1920x1080_-_30.000_fps_-_VP9.webm
Going from Out_av1_-_AV1_-_AV1.webm
to Out_av1_-_AV1_-_1920x1080_-_30.000_fps_-_AV1.webm
Going from Out_vp9_-_VP9_-_VP9.webm
to Out_vp9_-_VP9_-_1920x1080_-_30.000_fps_-_VP9.webm
And again, the script is here: https://marc.merlins.org/linux/scripts/vidrename |