ffmpeg/wip
This commit is contained in:
parent
22fa109aac
commit
149cc47894
1 changed files with 66 additions and 14 deletions
80
sh/ffmpeg.sh
80
sh/ffmpeg.sh
|
@ -26,6 +26,18 @@ rwx_ffmpeg_device_formats() {
|
||||||
# │ ffmpeg │ input │
|
# │ ffmpeg │ input │
|
||||||
# ╰────────┴───────╯
|
# ╰────────┴───────╯
|
||||||
|
|
||||||
|
rwx_ffmpeg_input_blue_yeti() {
|
||||||
|
local device="alsa_input.\
|
||||||
|
usb-Generic_Blue_Microphones_2051BAB04XY8-00.analog-stereo"
|
||||||
|
set -- \
|
||||||
|
-f "pulse" \
|
||||||
|
-i "${device}" \
|
||||||
|
-ac "2" \
|
||||||
|
-ar "48000"
|
||||||
|
local argument
|
||||||
|
for argument in "${@}"; do echo "${argument}"; done
|
||||||
|
}
|
||||||
|
|
||||||
rwx_ffmpeg_input_file() {
|
rwx_ffmpeg_input_file() {
|
||||||
local file="${1}"
|
local file="${1}"
|
||||||
local from="${2}"
|
local from="${2}"
|
||||||
|
@ -59,23 +71,43 @@ rwx_ffmpeg_input_nearstream_ccd10() {
|
||||||
# │ ffmpeg │ output │
|
# │ ffmpeg │ output │
|
||||||
# ╰────────┴────────╯
|
# ╰────────┴────────╯
|
||||||
|
|
||||||
rwx_ffmpeg_output_fast() {
|
rwx_ffmpeg_output_audio_fast() {
|
||||||
|
set -- \
|
||||||
|
-codec:a "flac" \
|
||||||
|
-compression_level "0"
|
||||||
|
local argument
|
||||||
|
for argument in "${@}"; do echo "${argument}"; done
|
||||||
|
}
|
||||||
|
|
||||||
|
rwx_ffmpeg_output_audio_slow() {
|
||||||
|
set -- \
|
||||||
|
-codec:a "libopus" \
|
||||||
|
-b:a "128k"
|
||||||
|
local argument
|
||||||
|
for argument in "${@}"; do echo "${argument}"; done
|
||||||
|
}
|
||||||
|
|
||||||
|
rwx_ffmpeg_output_file() {
|
||||||
local file="${1}"
|
local file="${1}"
|
||||||
[ -n "${file}" ] || return
|
[ -n "${file}" ] || return
|
||||||
set -- \
|
set -- \
|
||||||
-codec:v "libx264" \
|
|
||||||
-preset "ultrafast" \
|
|
||||||
-crf "0" \
|
|
||||||
-y "${file}"
|
-y "${file}"
|
||||||
local argument
|
local argument
|
||||||
for argument in "${@}"; do echo "${argument}"; done
|
for argument in "${@}"; do echo "${argument}"; done
|
||||||
}
|
}
|
||||||
|
|
||||||
rwx_ffmpeg_output_slow() {
|
rwx_ffmpeg_output_video_fast() {
|
||||||
local file="${1}"
|
set -- \
|
||||||
local crf="${2}"
|
-codec:v "libx264" \
|
||||||
local codec="${3}"
|
-preset "ultrafast" \
|
||||||
[ -n "${file}" ] || return
|
-crf "0"
|
||||||
|
local argument
|
||||||
|
for argument in "${@}"; do echo "${argument}"; done
|
||||||
|
}
|
||||||
|
|
||||||
|
rwx_ffmpeg_output_video_slow() {
|
||||||
|
local crf="${1}"
|
||||||
|
local codec="${2}"
|
||||||
[ -n "${codec}" ] || codec="libx264"
|
[ -n "${codec}" ] || codec="libx264"
|
||||||
if [ -z "${crm}" ]; then
|
if [ -z "${crm}" ]; then
|
||||||
case "${codec}" in
|
case "${codec}" in
|
||||||
|
@ -89,8 +121,7 @@ rwx_ffmpeg_output_slow() {
|
||||||
-preset "veryslow" \
|
-preset "veryslow" \
|
||||||
-crf "${crf}" \
|
-crf "${crf}" \
|
||||||
-movflags "+faststart" \
|
-movflags "+faststart" \
|
||||||
-pix_fmt "yuv420p" \
|
-pix_fmt "yuv420p"
|
||||||
-y "${file}"
|
|
||||||
local argument
|
local argument
|
||||||
for argument in "${@}"; do echo "${argument}"; done
|
for argument in "${@}"; do echo "${argument}"; done
|
||||||
}
|
}
|
||||||
|
@ -99,13 +130,34 @@ rwx_ffmpeg_output_slow() {
|
||||||
# │ ffmpeg │ record │
|
# │ ffmpeg │ record │
|
||||||
# ╰────────┴────────╯
|
# ╰────────┴────────╯
|
||||||
|
|
||||||
rwx_ffmpeg_record_ccd10() {
|
rwx_ffmpeg_record_ccd10_yeti() {
|
||||||
local file="${1}"
|
local file="${1}"
|
||||||
[ -n "${file}" ] || return
|
[ -n "${file}" ] || return
|
||||||
set -- \
|
set -- \
|
||||||
$(rwx_ffmpeg_input_nearstream_ccd10) \
|
$(rwx_ffmpeg_input_nearstream_ccd10) \
|
||||||
$(rwx_ffmpeg_output_fast "${file}")
|
$(rwx_ffmpeg_input_blue_yeti) \
|
||||||
local argument
|
$(rwx_ffmpeg_output_video_fast) \
|
||||||
|
$(rwx_ffmpeg_output_audio_fast) \
|
||||||
|
$(rwx_ffmpeg_output_file "${file}")
|
||||||
|
echo "${@}"
|
||||||
|
ffmpeg "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ╭────────┬────────╮
|
||||||
|
# │ ffmpeg │ reduce │
|
||||||
|
# ╰────────┴────────╯
|
||||||
|
|
||||||
|
rwx_ffmpeg_reduce() {
|
||||||
|
local input="${1}"
|
||||||
|
local output="${2}"
|
||||||
|
local from="${3}"
|
||||||
|
local to="${4}"
|
||||||
|
[ -n "${output}" ] || return
|
||||||
|
set -- \
|
||||||
|
$(rwx_ffmpeg_input_file "${input}" "${from}" "${to}") \
|
||||||
|
$(rwx_ffmpeg_output_video_slow) \
|
||||||
|
$(rwx_ffmpeg_output_audio_slow) \
|
||||||
|
$(rwx_ffmpeg_output_file "${output}")
|
||||||
echo "${@}"
|
echo "${@}"
|
||||||
ffmpeg "${@}"
|
ffmpeg "${@}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue