FFMPEG-无法解析多行文件

FFMPEG-无法解析多行文件

我正在尝试解析 FFmpeg 输出文件的行。我尝试创建一个逐行读取行的变量,但每次我这样做时都会出现“[NULL @ 0x7fa9cb000000] 无法找到适合 '' 的输出格式:无效参数”

#!/bin/bash
origfolderdirectory=${PWD} # This is the original folder directory path.
origfoldername=${PWD##*/} # This is the original folder name.

# This creates a temp folder where all the temporary files will stay.
mkdir -p Temp 

# This grabs a list of all .mp4 files and puts the output into files.txt
find . -name "*.mp4" >> ./Temp/files.txt 

cd Temp

# This removes the dots from the start of every line in files.txt and outputs fileswithoutdot.txt
cat files.txt | sed 's/^..//' > fileswithoutdot.txt 

# This adds the original folder name to the start of each line in fileswithoutdot.txt and outputs to prefixfiles.txt
cat fileswithoutdot.txt | sed -e "s#^#$origfolderdirectory#g" > prefixfiles.txt 

# This adds ../Encoded. to the start of every line in prefixfiles.txt and outputs to prefixedfiles.txt
cat prefixfiles.txt | sed -e "s#$origfoldername#Encoded./$origfoldername./#" > prefixedfiles.txt 

# Reads out prefixedfiles.txt for FFMPEG.
OUTPUT="$(cat prefixedfiles.txt)"

# Backs out of Temp folder
cd ../ 

# Copies folder structure of $origfoldername to ../Encoded.
find . -type d -exec mkdir -p -- ../Encoded./$origfoldername{} \; 

# Removes temp folder from ../Encoded
rm -r ../Encoded./$origfoldername./Temp

# Do Encode
find . -name *.mp4 -exec ffmpeg -i {} -vcodec libx264 -acodec copy -threads 10 -crf 18 "${OUTPUT}" \;

prefixedfiles.txt 的示例

Test/test.mp4
Test/More Testing/test2.mp4

相关内容