Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Modifications
- # Current Settings Works Well For the GenerPlus Large TF Files from HDD Model. 2.5GB 20min files compress to around 300mb with similar quality
- # Add -nostdin so that hopefully ffmpeg can automatically process each file on each line as had issues
- READFILE=$1
- PREFIX='Transcode'
- FFMPEG="C:\ffmpeg\bin\ffmpeg.exe"
- echo "Utilizing $file"
- while IFS= read -r line
- do
- echo "Current File Being Processed $line"
- line=$(basename $line)
- echo " Target file is ${line}"
- #---------------------------------#
- # Argument needs to come before the input file for
- # If the hardware supports encoding then use one filled in. If not then use the blank
- # HARDWARE ACCELERATION DECODE/ENCODE
- # HWACCEL=""
- HWACCEL="-hwaccel cuda -hwaccel_output_format cuda"
- # HWACCEL="-hwaccel vaapi -hwaccel_output_format vapi"
- #---------------------------------#
- # Video encoder
- # -c:v libx264 # H.264 CPU encoding
- # -c:v libx265 # H.265 CPU encoding
- # -c:v av1_nvenc # AV1 NVENC GPU encoding
- # -c:v h264_nvenc # H.264 NVENC GPU encoding
- # -c:v hevc_nvenc # H.265 NVENC GPU encoding
- VIDEO_CODEC="-c:v hevc_nvenc"
- #---------------------------------#
- # Audio encoder
- AUDIO_CODEC="-c:a libmp3lame"
- #---------------------------------#
- # Filters
- # -vf vflip # vertically flip video
- # -vf nlmeans # deinterlace
- # -vf atadenoise \ # denoise (slows down alot)
- FILTERS=""
- # Other
- # -fps_mode vfr is equal to -vsync 2 for newer version of ffmpeg
- #---------------------------------#
- # Video Bitrate settings. (Add an audio)
- BITRATE="-b:v 2M -maxrate 8M -bufsize 2M"
- $FFMPEG -nostdin -i \
- $HWACCEL \
- "$line" \
- $BITRATE \
- $VIDEO_CODEC \
- $AUDIO_CODEC \
- -fps_mode vfr \
- $FILTERS \
- "${PREFIX}${line}.mp4"
- # $FFMPEG -nostdin -i "$line" \
- # -b:v 1.7M -maxrate 8M -bufsize 2M \
- # -b:a 80k \
- # -c:v hevc_nvenc \
- # -c:a libmp3lame \
- # -fps_mode vfr \
- # -vf nlmeans,atadenoise \
- # "${PREFIX}${line}.mp4"
- echo "Line --> ${line} finished"
- done < "$READFILE"
Advertisement
Add Comment
Please, Sign In to add comment