RE: EPG Inside .ts File » konvToTV.sh
1 |
#!/bin/bash
|
---|---|
2 |
function schleife { |
3 |
for file in "$1"* ; do |
4 |
if [ -d "$file" ] |
5 |
then
|
6 |
schleife "$file/" |
7 |
elif [[ "$file" == *.m* ]] |
8 |
then
|
9 |
filename=$(basename "$file" ) |
10 |
newfilename="${filename%.*}" |
11 |
newfilename=${newfilename//&/and} |
12 |
newfilename=${newfilename//\'/} |
13 |
newfilename=${newfilename//\./}".mkv"
|
14 |
# 4:3
|
15 |
#ffmpeg -i "$file" -vf scale=720:576,pad=1024:576:152:0 -c:v libx264 -preset ultrafast -crf 25 -c:a aac -sn -strict -2 "$outputpath""$newfilename"
|
16 |
|
17 |
# anamorphic 16:9
|
18 |
/opt/ffmpeg-3.4/ffmpeg -i "$file" -flags +global_header -vf scale=1024:576 -c:v libx264 -preset ultrafast -crf 25 -c:a aac -ac 2 -b:a 256k -sn "$outputpath""$newfilename"
|
19 |
|
20 |
filelength=$(ffprobe -i "$file" -show_entries format=duration -v quiet -of csv="p=0" -sexagesimal)
|
21 |
filelength=$(echo "$filelength" | cut -d '.' -f 1) |
22 |
|
23 |
filetxt=${filename%.*}
|
24 |
|
25 |
pathtxt="../${outputname%.*}.txt"
|
26 |
echo "$filelength"":""$filetxt" >> "$pathtxt"
|
27 |
fi
|
28 |
done
|
29 |
}
|
30 |
|
31 |
# Edit this
|
32 |
inputpath="Path to series input Folder"
|
33 |
outputname="New file name.mkv"
|
34 |
outputpath="Path to output folder without / at end"
|
35 |
# Edit end
|
36 |
|
37 |
outputpath="$outputpath""/tmp/"
|
38 |
mkdir "$outputpath"
|
39 |
cd "$outputpath"
|
40 |
schleife "$inputpath"
|
41 |
cd "$outputpath"
|
42 |
|
43 |
# Create list of files for concatination
|
44 |
for f in ./*.mkv; do
|
45 |
echo "file '$f'" >> list.txt; |
46 |
done
|
47 |
|
48 |
# Create new concatinated video file and clean up
|
49 |
/opt/ffmpeg-3.4/ffmpeg -f concat -safe 0 -i list.txt -flags +global_header -c copy ../"$outputname"
|
50 |
rm -R $outputpath
|