<commit_before>#!/bin/sh

# 4chan webm maker

START_TIME="0:00:00"
DURATION="120" # Max 120s
MAX_SIZE="3M" # 3072KB
COMPRESSION="10" # [4, 63]
AUDIO_QUALITY="3"

ffmpeg -i "$1" -ss "$START_TIME" -t "$DURATION" -vcodec libvpx -crf "$COMPRESSION" -acodec libvorbis -aq "$AUDIO_QUALITY" -fs "$MAX_SIZE" "$2" -pass1
ffmpeg -i "$1" -ss "$START_TIME" -t "$DURATION" -vcodec libvpx -crf "$COMPRESSION" -acodec libvorbis -aq "$AUDIO_QUALITY" -fs "$MAX_SIZE" "$2" -pass2


# TODO
# OPENCL/MULTITHREADING
# MAX_DIMENSIONS of 2048x2048
# AUTOMATICALLY SET COMPRESSION
# -to
# TOGGLE AUDIO WITH -an (/b/)
# CHECK -threads
# CHECK allowed for 4chan
# youtube-dl
# automatically $2 from $1 if not defined
# bitrate
<commit_msg>bitrates<commit_after>#!/bin/sh

# 4chan webm maker

START_TIME="0:00:00"
DURATION="60" # Max 120s
#MAX_SIZE="3145728" # 3MB 
MAX_SIZE="4194304" # 4MB
RESOLUTION="720" #720p

in="$1"
out="$2"
shift 2

a_bitrate="96000"
v_bitrate="$((8*$MAX_SIZE/$DURATION-$a_bitrate))"

ffmpeg -i "$in" -ss "$START_TIME" -t "$DURATION" -map_metadata -1 -c:v libvpx -b:v "${v_bitrate}" -vf scale=-1:"$RESOLUTION" -c:a libvorbis -b:a "$a_bitrate" -quality best "$out" -pass 1 $@ &&\
ffmpeg -i "$in" -ss "$START_TIME" -t "$DURATION" -map_metadata -1 -c:v libvpx -b:v "${v_bitrate}" -vf scale=-1:"$RESOLUTION" -c:a libvorbis -b:a "$a_bitrate" -quality best "$out" -pass 2 $@ -y


# TODO
# OPENCL/MULTITHREADING
# MAX_DIMENSIONS of 2048x2048
# -to
# TOGGLE AUDIO WITH -an (/b/)
# CHECK -threads
# CHECK allowed for 4chan
# youtube-dl
# automatically $2 from $1 if not defined

{'fraction_non_alphanumeric': 0.17868538608806636, 'fraction_numerical': 0.0631780472239949, 'mean_word_length': 4.4825174825174825, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1911829', 'n_tokens_mistral': 756, 'n_tokens_neox': 680, 'n_words': 175}