0.0
No commit activity in last 3 years
No release in over 3 years
Rename the mp4 and m4a files by adding the running time to the end of the filename TL;DR rename 'media_file.mp4' to 'media_file_12_34.mp4' if the running time is '12:34' minutes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 1.0
~> 2.12
~> 5.6
~> 0.10
~> 10.4
~> 0.31
~> 0.8

Runtime

~> 1.7.3
~> 0.19
 Project Readme

Mp4Renamer

Gem Version Dependency Status Code Climate

Simple gem to rename the mp4 or m4a file by adding the running time to the input file name.

e.g. If the input file name is introduction.mp4 and it contain 00:54 of running time then the file would be renamed to introduction_00_54.mp4 e.g. <original_filename><running_time>.mp4

  • Support the *.m4a and *.mp4 file formats only

Sample Usage

  • Install the gem
$gem install mp4_renamer
  • Running the command without any argument will show the default help message
mp4_renamer

Should show the following output

Usage:
  mp4_renamer [options]

Options:
  -b, [--base-dir=BASE_DIR]        # Starting directory
                                   # Default: . (current directory)
  -r, [--recursive=RECURSIVE]      # Perform the operation recursively
                                   # Default: true
  -c, [--commit], [--no-commit]    # Commit your changes
                                   # Default: --no-commit
  -v, [--version], [--no-version]  # Display version number
                                   # Default: --no-version

Execute the main program
  • Running the default command to see what will the result be like without making any changes (dry-run)
mp4_renamer --base-dir . --recursive

# or short version
mp4_renamer -b . -r

Should show outputs similar to the following

FYI: your options {:base_dir=>".", :recursive=>true, :commit=>false, :version=>false}
-----------------------------------------------------------------------
FYI: this is a dry-run only, to commit your changes use --commit option
-----------------------------------------------------------------------
FYI: input file : ./fixtures/01.mp4
FYI: output file: ./fixtures/01_00_54.mp4
FYI: input file : ./fixtures/02.mp4
FYI: output file: ./fixtures/02_00_54.mp4
  • To make your change permanent just add the --commit flag
mp4_renamer --base-dir . --recursive --commit
# or short version
mp4_renamer -b . -r -c

Why is this useful?

  • Know how long it will take to watch the video
  • Give you the context without the need to open file and look at the running time of a given file
  • To make your output even more useful, try using this with filename_cleaner gem

Installation

Add this line to your application's Gemfile:

gem 'mp4_renamer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mp4_renamer

Usage

Use as library try

require 'mp4_renamer'
include Mp4Renamer
# then call the appropriate functions

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request