Skip to content

Instantly share code, notes, and snippets.

@dmacsuibhne
dmacsuibhne / correct_video_date.sh
Last active December 13, 2023 17:23
Restore video creation date after it has been stripped by e.g. Google-Photos or ffmpeg
#!/bin/bash
set -o nounset
directory_original=./keep/conv35veryslow
for filepath in ${directory_original}/*; do
# echo $filepath
if (echo $filepath | grep -P 'VID_20\d{6}_\d{6}[^\d]' > /dev/null); then
# echo "FORMAT1 VID_YYYYMMDD_hhmmss"
partial_filename=$(echo -n $filepath | sed 's#.*VID_##g')
YYYY="${partial_filename:0:4}"
@dmacsuibhne
dmacsuibhne / compressVideos.sh
Last active December 5, 2023 18:20
Compress videos with ffmpeg
#!/bin/bash
encoder=libx265
crf_value=35
preset_value="medium"
directory_original=./keep
directory_new="$directory_original/conv$crf_value$preset_value"
for filepath in ${directory_original}/*; do
if [ ! -d "$filepath" ]; then #exclude directories
filename_with_extension="${filepath##*/}"
filename_no_extension="${filename_with_extension%.*}"