Skip to content

Instantly share code, notes, and snippets.

@Torstein-Eide
Last active August 16, 2021 09:28
Show Gist options
  • Save Torstein-Eide/280a503c4602800efb0e4b22660308ba to your computer and use it in GitHub Desktop.
Save Torstein-Eide/280a503c4602800efb0e4b22660308ba to your computer and use it in GitHub Desktop.
Manage media

how to manange media files

Install

sudo apt install libimage-exiftool-perl 

Batch metadata editing:

Replace the file name with a directory name to modify all files in a directory. Use a dot . for the current directory.

  • Remember that extensions and filenames are case sensitive on Linux. Especially when using wildcards, *.jpg is not the same as *.JPG.
  • ExifTool creates a copy of the original file, appending _original to the file name, as a backup. To avoid that and modify files directly, use the -overwrite_original option. Format the copyright notice according to your country: Guide to photo metadata fields / Copyright Notice

Sort files to directors based on metadata:

Based on Orignal date and Time

exiftool "-Directory<DateTimeOriginal" -d "%Y/%Y-%m-%d" .

Based on last modify

Mindre nøyaktig.

exiftool "-Directory<filemodifydate" -d "%Y/%Y-%m-%d" .

Display metadata information

exiftool "file_name.extension"

Metadata information can also be exported to an html document:

exiftool -h . > example.html

Add Creator / Author to image metadata

Add or change creator/author information of the XMP Dublin Core standard schema:

exiftool -artist=me a.jpg
exiftool -XMP-dc:Creator="Creator" "file_name.extension"

Remove all metadata

exiftool -all= -overwrite_original "file name.extension"

Sources:

FFMPEG

Convert AVI to MP4, lossy

ffmpeg -i input.avi -c:v libx264 -crf 19 -preset slow -c:a libfdk_aac -b:a 192k -ac 2 out.mp4

Less verbose

ffmpeg -hide_banner -loglevel error

The option -hide_banner was introduced in late 2013 -- https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2013-December/152349.html )

-loglevel warning leads to more verbose output as it shows all warning messages

-loglevel panic is the least verbose output (omitting even error messages) but is undocumented.

Sources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment