Marc's Public Blog - Linux Hacking


All | Aquariums | Arduino | Btrfs | Cars | Cats | Clubbing | Computers | Diving | Dreamstate | Edc | Electronics | Exercising | Festivals | Flying | Halloween | Hbot | Hiking | Linux | Linuxha | Monuments | Museums | Oshkosh | Outings | Public | Rc | Sciencemuseums | Solar | Tfsf | Trips



>>> Back to post index <<<

2024/11/17 Vidrename Script: Clean-up/Normalize Video Filenames and Add Codec And Container Format With Mplayer
π 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


    More pages: July 2002 February 2004 March 2004 November 2004 April 2005 August 2005 January 2006 July 2006 August 2007 November 2007 January 2008 October 2008 November 2008 December 2008 January 2009 May 2009 July 2009 August 2009 September 2009 November 2009 December 2009 January 2010 March 2010 April 2010 June 2010 August 2010 October 2010 January 2011 July 2011 August 2011 December 2011 January 2012 March 2012 May 2012 August 2012 December 2012 January 2013 March 2013 May 2013 September 2013 November 2013 January 2014 March 2014 April 2014 May 2014 October 2014 January 2015 March 2015 May 2015 January 2016 February 2016 June 2016 July 2016 August 2016 October 2016 January 2017 September 2017 January 2018 March 2018 December 2018 January 2019 January 2020 May 2020 January 2021 September 2021 March 2023 April 2023 December 2023 June 2024 November 2024

    >>> Back to post index <<<

    Contact Email