Search This Blog

Thursday, November 9, 2023

[Ubuntu] Convert mp4 video to aac audio

 

#!/bin/bash

# Define the target directory
directory="."

# Check if the target is not a directory
if [ ! -d "$directory" ]; then
  exit 1
fi

# Loop through files in the target directory
for file in "$directory"/*; do
  if [ -f "$file" ]; then
    if [ "${file##*.}" == "mp4" ]; then
        echo "${file%.*}.aac"
        ffmpeg -i "$file" -c:a aac -b:a 128k -vn "${file%.*}.aac"
    fi
  fi
done

 

Wednesday, April 12, 2023

[Ubuntu] find command with grep

 find -name "*.java" -exec grep "foo" -Hn {} \;

 

-H Display filesname

-n Display line number

Monday, March 27, 2023

[Ubuntu] Create tar file exclude specified directory

Tar foo directory, and exclude "foo/.repo"  directory

─foo

   ├─.repo

   │     └─ example

   └─ 1.txt

$ tar -cvf foo.tar --exclude='foo/.repo' foo


Remove directory "foo/.repo" from tar file

$ tar --delete foo/.repo -f foo.tar