bash FFMPEG - ".mp4 no such file or directory"

标签 bash ffmpeg

我正在使用 FFMPEG 将 .asf 流保存到 Ubuntu 计算机上的 mp4 中,输出文件名是时间戳。代码如下:

current_time=$(date "+%m/%d/%Y_%H:%M:%S")
ffmpeg -i http://username:password@IP:Port/videostream.asf -r 10 -vcodec copy -an -t 60 $current_time.mp4

但是,我收到“.mp4 没有此类文件或目录”错误。

最佳答案

bash does not allow to you create file-names with / present

According to POSIX "[t]he characters composing the [file] name may be selected from the set of all character values excluding the slash character and the null byte". In other words, every string between two slashes ([except the empty string]) is another directory, and you cannot create a file with a name containing slashes.

创建时不带斜杠,

ffmpeg -i http://username:password@IP:Port/videostream.asf -r 10 -vcodec copy -an -t 60 "${current_time//\//_}".mp4

(或)将时间字符串更改为在时间戳映射中不包含“/”,

current_time="$(date "+%m_%d_%Y_%H:%M:%S")"
ffmpeg -i http://username:password@IP:Port/videostream.asf -r 10 -vcodec copy -an -t 60 "${current_time}".mp4

关于 bash FFMPEG - ".mp4 no such file or directory",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42061657/

相关文章:

linux - 如何在脚本中获取valgrind是否发现内存泄漏?

c - 使用 muxing 文档示例的 FFMPEG RTSP 服务器

audio - 如何在 ffmpeg 捕获期间监控音量级别

php - 如何在 PHP 中安装 FFMPEG 来编码视频

linux - 在任何给定时间运行 5 个脚本

linux - bash lsof : get pid from one tty to another one

bash - 在 Ubuntu 中使用 bashrc 定义带循环的别名

android - 如何在 Android 上使用 java/kotlin 减小视频大小?

javascript - 流畅的ffmpeg没有同步运行

linux - 如何在 bash 中对逗号分隔值进行排序?