Last active
June 8, 2020 00:41
-
-
Save eightpigs/284db225b8b3bc07b0ffb16cd30469ea to your computer and use it in GitHub Desktop.
腾讯视频客户端(MacOS)缓存文件转mp4 https://asciinema.org/a/176189 http://lyinlong.me/2018/04/14/tencent_video_cache_file_to_mp4_in_macos/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
clear | |
cat << EOF | |
################### 腾讯视频(MacOS)缓存文件合成脚本 ################### | |
Author: eightpigs <[email protected]> | |
Date: 2018-04-14 | |
EOF | |
echo -n "=> 准备数据... " | |
# 生成的目标文件 | |
target=$2 | |
# 源文件(.ts文件的目录) | |
source='/Users/'$USER'/Library/Containers/com.tencent.tenvideo/Data/Library/Application Support/Download/video/'$1'/' | |
# 使用时间戳来做临时目录 | |
tmpDir='/tmp/merge_tencent/'`date +%s`'/' | |
mkdir -p $tmpDir | |
# 进入到视频的ts目录 | |
cd "$source" | |
echo "完成" | |
echo -n "=> 合并文件夹... " | |
# 将文件递归移动到临时目录 | |
for i in $(find ./ -name '*.ts'); | |
do | |
cp -vf $i $tmpDir > /dev/null 2>&1; | |
done | |
echo "完成" | |
cd $tmpDir | |
echo -n "=> 获取需要合成文件数... " | |
# 总共有多少文件 | |
# 因为ts 文件是有顺序的(文件名) | |
count=`ls -l $tmpDir |grep "^-"|wc -l | sed 's/[[:space:]]//g'` | |
echo "完成" | |
echo -n "=> 合成文件... " | |
# 按顺序合并 | |
for ((i=0; i<$count; i ++)) | |
do | |
cat "$tmpDir"$i'.ts'>>"$target" | |
done | |
echo "完成" | |
cat << EOF | |
结果: | |
文件数: $count | |
大小: `ls -lh $target | awk '{print $5}'` | |
路径:$target | |
###################################################################### | |
EOF | |
rm -rf $tmpDir |
Author
eightpigs
commented
Apr 14, 2018
怎么运行这个文件。。。。
怎么运行这个文件。。。。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment