[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1696106115489018.gif (350 KB, 800x520)
350 KB GIF
for i in *.flac; do ffmpeg -i "&i" "${i%.*}.mp3"; done; rm *.flac
>>
>>109066389
Here's my interactive bash script for cleaning up .mkvs with niche audio formats to clean & portable .aac audio for .mp4 containers :)

#!/bin/bash

#MacOS only
# Ask the user to choose a file (Call Finder GUI dialog)
SOURCE_FILE=$(osascript -e 'POSIX path of (choose file with prompt "Select a video file (.mp4 or .mkv) to convert")')

# Remove trailing newline just in case
SOURCE_FILE=$(echo "$SOURCE_FILE" | tr -d '\n')

# If cancelled
if [[ -z "$SOURCE_FILE" ]]; then
echo "No file selected. Exiting."
exit 1
fi

# Ask if source audio is 7.1, 5.1, 2.1 or 2.0
echo "Is the source audio 7.1, 5.1, 2.1 or 2.0?"
select AUDIO_TYPE in "7.1" "5.1" "2.1" "2.0" "Cancel"; do
case $AUDIO_TYPE in
"7.1") AC_CHANNELS=8; break ;;
"5.1") AC_CHANNELS=6; break ;;
"2.1") AC_CHANNELS=3; break ;;
"2.0") AC_CHANNELS=2; break ;;
"Cancel") echo "Cancelled."; exit 0 ;;
*) echo "Invalid choice. Please choose 1, 2, 3 or 4." ;;
esac
done

# Get file name without extension
BASENAME=$(basename "$SOURCE_FILE")
NAME_NO_EXT="${BASENAME%.*}"

# Create output filename in the same folder, always .mp4
OUTPUT_FILE="$(dirname "$SOURCE_FILE")/${NAME_NO_EXT}-aac.mp4"

# Run ffmpeg command - copy video, convert audio to AAC, force .mp4 container
ffmpeg -i "$SOURCE_FILE" -c:v copy -c:a aac -b:a 896k -ac "$AC_CHANNELS" -movflags +faststart "$OUTPUT_FILE"

# Notify when done
if [[ $? -eq 0 ]]; then
osascript -e 'display notification "Audio conversion completed" with title "FFmpeg"'
echo "Conversion completed: $OUTPUT_FILE"
else
osascript -e 'display notification "Conversion failed" with title "FFmpeg"'
echo "Conversion failed."
fi
>>
File: FRnYR_kXwAA4U37.jpg (105 KB, 1075x1250)
105 KB JPG
>>109066389
for f in *.flac; do oggenc -q 6 "$f" && rm -- "$f"; done
>>
>>109066389
why would anyone destroy a flac file
just kys
>>
beet import
>>
>>109066389
Shitty script. If the ffmpeg conversion fails, you still unconditionally remove the original source.
>>
>>109066389
>&i
This won't even work! You get a bunch of missing file errors then delete all the flacs anyway
>>
>>109066477
>bash
filtered and retarded
>>109066795
>losing source
your fault for not having backup nigger
>>
>>109066389
audiophile bros wtf is he doing
>>
>>109066389
find . -name "*.flac" -follow -print0 | parallel -0 ffmpeg -i {} -b:a 128k {.}.opus -y
>>
>>109066389
>128kbps MP3
b..b..based?
>>
>>109066389
>>109066642
based *.flac destroyers
>>
>>109066389
I look like this and run this
>>
>>109068968
that is so cool. gotta keep those cores cookin'
>>
>>109066389
bash syntax is so bad
>>
kill all chuds



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.