如何使用ffmpeg与h.265(或h.264)编码?

时间:2022-07-06 04:18:15

Normally I start recording the camera image with the command:

通常我会使用以下命令开始录制摄像机图像:

ffmpeg -y -f vfwcap -r 25 -i 0 OUT.mp4

ffmpeg -y -f vfwcap -r 25 -i 0 OUT.mp4

but I'm not sure which coded do I use in here (I'm just beginning my adventure with ffmpeg), however I found on this webpage this command:

但我不确定我在这里使用哪种编码(我刚开始用ffmpeg进行冒险),但是我在这个网页上找到了这个命令:

ffmpeg -i INPUT -c:a copy -x265-params crf=25 OUT.mov

ffmpeg -i INPUT -c:副本-x265-params crf = 25 OUT.mov

But when I run it - I get the following error: INPUT: No such file or directory"

但是当我运行它时 - 我收到以下错误:INPUT:没有这样的文件或目录“

I changed the INPUT word above also to 0, so the command is

我将上面的INPUT字也改为0,所以命令是

ffmpeg -i 0 -c:a copy -x265-params crf=25 OUT.mov, but error stays similar (0: no such file or directory). How can I grab the camera image and save it to a file while using the H.265?

ffmpeg -i 0 -c:副本-x265-params crf = 25 OUT.mov,但错误保持相似(0:没有这样的文件或目录)。在使用H.265时,如何抓取相机图像并将其保存到文件中?

1 个解决方案

#1


You'll have to get a better understanding of how ffmpeg works and what each parameter means. The documentation is here, have fun.

您必须更好地了解ffmpeg的工作原理以及每个参数的含义。文档在这里,玩得开心。

In your case:

在你的情况下:

          |------ input ------||----- output ------|

ffmpeg -y -f vfwcap -r 25 -i 0 -c:v libx265 out.mp4

Your input is a vfwcap device with the ID 0 which captures at a rate of 25 fps. Your output is a mp4 file containing a video stream encoded with libx265.

您的输入是一个ID为0的vfwcap设备,其捕获速率为25 fps。您的输出是一个mp4文件,其中包含使用libx265编码的视频流。

If you use -i 0 wihtout a format it assumes you're trying to input a file, and it obviously can't find that file.

如果你使用-i 0没有格式,它假设你正在尝试输入一个文件,它显然找不到该文件。

For all this to work you need to have the x265 encoder installed on your system and FFmpeg compiled with libx265 support.

为了实现这一切,您需要在系统上安装x265编码器,并使用libx265支持编译FFmpeg。

#1


You'll have to get a better understanding of how ffmpeg works and what each parameter means. The documentation is here, have fun.

您必须更好地了解ffmpeg的工作原理以及每个参数的含义。文档在这里,玩得开心。

In your case:

在你的情况下:

          |------ input ------||----- output ------|

ffmpeg -y -f vfwcap -r 25 -i 0 -c:v libx265 out.mp4

Your input is a vfwcap device with the ID 0 which captures at a rate of 25 fps. Your output is a mp4 file containing a video stream encoded with libx265.

您的输入是一个ID为0的vfwcap设备,其捕获速率为25 fps。您的输出是一个mp4文件,其中包含使用libx265编码的视频流。

If you use -i 0 wihtout a format it assumes you're trying to input a file, and it obviously can't find that file.

如果你使用-i 0没有格式,它假设你正在尝试输入一个文件,它显然找不到该文件。

For all this to work you need to have the x265 encoder installed on your system and FFmpeg compiled with libx265 support.

为了实现这一切,您需要在系统上安装x265编码器,并使用libx265支持编译FFmpeg。