查看“Ffmepg”的源代码
←
Ffmepg
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
=Usage= <pre> # mylist.txt >>> file '1.mp4' file '2.mp4' file '3.mp4' # 这些文件是相对路径,如使用绝对路径需要添加 `-safe 0` 参数 $ ffmpeg -f concat -i mylist.txt -c copy output.mp3 #or output.mp4 </pre> == 对有字母和数字的文件名排序后合并shell version== <pre> 原因 kevin大神合并的文件是有漏的,而我想合并一些只是自己喜欢学过的比较easy的 所以 1. 得到文件列表 ➜ for loop in `ls` for> do for> echo $loop for> done englishpod_B0111mydg.mp3 englishpod_B0113mydg.mp3 englishpod_B0115mydg.mp3 englishpod_B0119mydg.mp3 englishpod_C0112mydg.mp3 englishpod_C0114mydg.mp3 englishpod_C0118mydg.mp3 englishpod_D0117mydg.mp3 另存到 0 2. 按字母 awk sort ➜ awk -v OFS='\t' '{rec=$0; gsub(/[^[:digit:]]+/, "", rec); print rec, $0}' 0 |sort -nk1 | cut -d $'\t' -f2- englishpod_B0111mydg.mp3 englishpod_C0112mydg.mp3 englishpod_B0113mydg.mp3 englishpod_C0114mydg.mp3 englishpod_B0115mydg.mp3 englishpod_D0117mydg.mp3 englishpod_C0118mydg.mp3 englishpod_B0119mydg.mp3 awk -v OFS='\t' '{rec=$0; gsub(/[^[:digit:]]+/, "", rec); print rec, $0}' 0 |sort -nk1 | cut -d $'\t' -f2- >list.txt 3. 添加head ➜ 111 sed -i "s/^/file '/g" list.txt file 'englishpod_B0111mydg.mp3 file 'englishpod_C0112mydg.mp3 file 'englishpod_B0113mydg.mp3 file 'englishpod_C0114mydg.mp3 file 'englishpod_B0115mydg.mp3 file 'englishpod_D0117mydg.mp3 file 'englishpod_C0118mydg.mp3 file 'englishpod_B0119mydg.mp3 添加 tail ➜ 111 sed -i "s/$/&'/g" list.txt file 'englishpod_B0111mydg.mp3' file 'englishpod_C0112mydg.mp3' file 'englishpod_B0113mydg.mp3' file 'englishpod_C0114mydg.mp3' file 'englishpod_B0115mydg.mp3' file 'englishpod_D0117mydg.mp3' file 'englishpod_C0118mydg.mp3' file 'englishpod_B0119mydg.mp3' cat list.txt #最后文件列表文件排序后如下 file 'englishpod_B0111mydg.mp3' file 'englishpod_C0112mydg.mp3' file 'englishpod_B0113mydg.mp3' file 'englishpod_C0114mydg.mp3' file 'englishpod_B0115mydg.mp3' file 'englishpod_D0117mydg.mp3' file 'englishpod_C0118mydg.mp3' file 'englishpod_B0119mydg.mp3' ffmpeg -f concat -i list.txt -c copy 111-120.mp3 </pre> === shell 解说=== <pre> awk -v OFS='\t' '{rec=$0; gsub(/[^[:digit:]]+/, "", rec); print rec, $0}' file | sort -nk1 | cut -d $'\t' -f2- bc14de cd 18 abc90 100def awk用于在输入中添加仅使用gsub的数字字符的第一列。 sort -nk1用于对第一列的输入进行数字排序。 cut最终用于截断第一列。 awk -v OFS='\t' '{rec=$0; gsub(/[^[:digit:]]+/, "", rec); print rec, $0}' file \ | sort -nk1 | cut -d $'\t' -f2- bc14de cd 18 abc90 100def awk is used to add a first column in input with only numeric characters using gsub sort -nk1 is used for sorting input numerically on first column cut is finally used to truncate first column </pre> https://stackoverflow.com/questions/31889233/how-to-sort-alphanumeric-by-numbers-in-shell https://wangchujiang.com/reference/docs/ffmpeg.html =install= ==yum== <pre> rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro #rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm yum install -y ffmpeg #ffmpeg-devel 开发包 </pre> =refercence= [https://www.cnblogs.com/wpjamer/p/ffmpeg.html CentOS中yum安装ffmpeg] [https://blog.csdn.net/weixin_40156882/article/details/121240732 nginx流媒体服务器(基于CentOS7)实现rtmp直播流,m3u8视频流] [[category:devops]]
返回至
Ffmepg
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
我的导航
关于我
shell
python
ops
linuxchina.net
blog.linuxchina
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息