savsanta

conv2.sh

Mar 5th, 2023 (edited)
622
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Modifications
  4. # Current Settings Works Well For the GenerPlus Large TF Files from HDD Model. 2.5GB 20min files compress to around 300mb with similar quality
  5. # Add -nostdin so that hopefully ffmpeg can automatically process each file on each line as had issues
  6.  
  7. READFILE=$1
  8. PREFIX='Transcode'
  9. FFMPEG="C:\ffmpeg\bin\ffmpeg.exe"
  10.  
  11. echo "Utilizing $file"
  12.  
  13. while IFS= read -r line
  14.  
  15. do
  16.  
  17. echo "Current File Being Processed $line"
  18. line=$(basename $line)
  19. echo " Target file is ${line}"
  20.  
  21. #---------------------------------#
  22. # Argument needs to come before the input file for
  23. # If the hardware supports encoding then use one filled in. If not then use the blank
  24. # HARDWARE ACCELERATION DECODE/ENCODE
  25. # HWACCEL=""
  26. HWACCEL="-hwaccel cuda -hwaccel_output_format cuda"
  27. # HWACCEL="-hwaccel vaapi -hwaccel_output_format vapi"
  28.  
  29.  
  30. #---------------------------------#
  31. # Video encoder
  32. # -c:v libx264 # H.264 CPU encoding
  33. # -c:v libx265 # H.265 CPU encoding
  34. # -c:v av1_nvenc # AV1 NVENC GPU encoding
  35. # -c:v h264_nvenc # H.264 NVENC GPU encoding
  36. # -c:v hevc_nvenc # H.265 NVENC GPU encoding
  37. VIDEO_CODEC="-c:v hevc_nvenc"
  38.  
  39. #---------------------------------#
  40. # Audio encoder
  41. AUDIO_CODEC="-c:a libmp3lame"
  42.  
  43. #---------------------------------#
  44. # Filters
  45. # -vf vflip # vertically flip video
  46. # -vf nlmeans # deinterlace
  47. # -vf atadenoise \ # denoise (slows down alot)
  48. FILTERS=""
  49.  
  50. # Other
  51. # -fps_mode vfr is equal to -vsync 2 for newer version of ffmpeg
  52.  
  53. #---------------------------------#
  54. # Video Bitrate settings. (Add an audio)
  55. BITRATE="-b:v 2M -maxrate 8M -bufsize 2M"
  56.  
  57. $FFMPEG -nostdin -i \
  58. $HWACCEL \
  59. "$line" \
  60. $BITRATE \
  61. $VIDEO_CODEC \
  62. $AUDIO_CODEC \
  63. -fps_mode vfr \
  64. $FILTERS \
  65. "${PREFIX}${line}.mp4"
  66.  
  67.  
  68. # $FFMPEG -nostdin -i "$line" \
  69. # -b:v 1.7M -maxrate 8M -bufsize 2M \
  70. # -b:a 80k \
  71. # -c:v hevc_nvenc \
  72. # -c:a libmp3lame \
  73. # -fps_mode vfr \
  74. # -vf nlmeans,atadenoise \
  75. # "${PREFIX}${line}.mp4"
  76.  
  77.  
  78. echo "Line --> ${line} finished"
  79.  
  80. done < "$READFILE"
  81.  
Advertisement
Add Comment
Please, Sign In to add comment