- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在按照 FFMpeg 的官方教程来创建过滤器链。 This教程展示了如何通过链传递数据:
The filter chain it uses is: * (input) -> abuffer -> volume ->aformat -> abuffersink -> (output)
frame = av_frame_alloc();
filterGraph = avfilter_graph_alloc();
if (!frame) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not allocate memory for frame");
return;
}
if (!filterGraph) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor FXProcessor! %s", av_err2str(AVERROR(ENOMEM)));
return;
}
const AVFilter *abuffer;
const AVFilter *abuffersink;
AVFilterContext *aformat_ctx;
const AVFilter *aformat;
AVFilterContext *choisen_beat_fx_ctx;
const AVFilter *choisen_beat_fx;
/* Create the abuffer filter;
* it will be used for feeding the data into the graph. */
abuffer = avfilter_get_by_name("abuffer");
if (!abuffer) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not find the abuffer filter!");
return;
}
abuffer_ctx = avfilter_graph_alloc_filter(filterGraph, abuffer, "src");
if (!abuffer_ctx) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not allocate the abuffer_ctx instance! %s",
av_err2str(AVERROR(ENOMEM)));
return;
}
char ch_layout[64];
/* Set the filter options through the AVOptions API. */
av_get_channel_layout_string(ch_layout, sizeof(ch_layout), 0, AV_CH_LAYOUT_STEREO);
av_opt_set(abuffer_ctx, "channel_layout", ch_layout, AV_OPT_SEARCH_CHILDREN);
av_opt_set(abuffer_ctx, "sample_fmt", av_get_sample_fmt_name(AV_SAMPLE_FMT_FLT),
AV_OPT_SEARCH_CHILDREN);
av_opt_set_q(abuffer_ctx, "time_base", (AVRational) {1, defaultSampleRate},
AV_OPT_SEARCH_CHILDREN);
av_opt_set_int(abuffer_ctx, "sample_rate", defaultSampleRate, AV_OPT_SEARCH_CHILDREN);
/* Now initialize the filter; we pass NULL options, since we have already
* set all the options above. */
if (avfilter_init_str(abuffer_ctx, nullptr) < 0) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not initialize the abuffer filter!");
return;
}
// TODO: select FX's dynamically
/* Create aecho filter. */
if (true) {
choisen_beat_fx = avfilter_get_by_name("volume");
if (!choisen_beat_fx) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not find the aecho filter!");
return;
}
choisen_beat_fx_ctx = avfilter_graph_alloc_filter(filterGraph, choisen_beat_fx, "echo");
if (!choisen_beat_fx_ctx) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not allocate the choisen_beat_fx_ctx instance! %s",
av_err2str(AVERROR(ENOMEM)));
return;
}
av_opt_set (choisen_beat_fx_ctx, "volume", AV_STRINGIFY(0.5), AV_OPT_SEARCH_CHILDREN);
if (avfilter_init_str(choisen_beat_fx_ctx, nullptr) < 0) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not initialize the choisen_beat_fx_ctx filter!");
return;
}
}
/* Create the aformat filter;
* it ensures that the output is of the format we want. */
aformat = avfilter_get_by_name("aformat");
if (!aformat) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not find the aformat filter!");
return;
}
aformat_ctx = avfilter_graph_alloc_filter(filterGraph, aformat, "aformat");
if (!aformat_ctx) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not allocate the aformat instance!");
return;
}
av_opt_set(aformat_ctx, "sample_fmts", av_get_sample_fmt_name(AV_SAMPLE_FMT_FLT),
AV_OPT_SEARCH_CHILDREN);
av_opt_set_int(aformat_ctx, "sample_rates", defaultSampleRate, AV_OPT_SEARCH_CHILDREN);
av_get_channel_layout_string(ch_layout, sizeof(ch_layout), 0, AV_CH_LAYOUT_STEREO);
av_opt_set(aformat_ctx, "channel_layouts", ch_layout, AV_OPT_SEARCH_CHILDREN);
if (avfilter_init_str(aformat_ctx, nullptr) < 0) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not initialize the aformat filter!");
return;
}
/* Finally create the abuffersink filter;
* it will be used to get the filtered data out of the graph. */
abuffersink = avfilter_get_by_name("abuffersink");
if (!abuffersink) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not find the abuffersink filter!");
return;
}
abuffersink_ctx = avfilter_graph_alloc_filter(filterGraph, abuffersink, "sink");
if (!abuffersink_ctx) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not allocate the abuffersink instance!");
return;
}
/* This filter takes no options. */
if (avfilter_init_str(abuffersink_ctx, nullptr) < 0) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Could not initialize the abuffersink instance.!");
return;
}
/* Connect the filters;
* in this simple case the filters just form a linear chain. */
if (avfilter_link(abuffer_ctx, 0, choisen_beat_fx_ctx, 0) != 0) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Error connecting filters.!");
return;
}
if (avfilter_link(choisen_beat_fx_ctx, 0, aformat_ctx, 0) != 0) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Error connecting filters.!");
return;
}
if (avfilter_link(aformat_ctx, 0, abuffersink_ctx, 0) != 0) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Error connecting filters.!");
return;
}
/* Configure the graph. */
if (avfilter_graph_config(filterGraph, nullptr) < 0) {
*mediaLoadPointer = FAILED_TO_LOAD;
LOGE("FXProcessor::FXProcessor Error configuring the filter graph!");
return;
}
当链是时,此代码工作正常
- (input) -> abuffer -> aecho-> aformat -> abuffersink -> (output)
adelay
而不是
volume
筛选。所以我想要:
The filter chain it uses is: * (input) -> abuffer -> volume ->aformat -> abuffersink -> (output)
choisen_beat_fx = avfilter_get_by_name("volume");
至
choisen_beat_fx = avfilter_get_by_name("aecho");
并删除了该行
av_opt_set (choisen_beat_fx_ctx, "volume", AV_STRINGIFY(0.5), AV_OPT_SEARCH_CHILDREN);
一切都很顺利,直到最后一行。
avfilter_graph_config
失败并返回负值。函数文档:
avfilter_graph_config: Check validity and configure all the links andformats in the graph.
最佳答案
好的,问题是,我需要使用 aresample
进行编译过滤这个工作。我重新编译并神奇地现在它可以工作了。
这是我发现问题的方法。创建一个通用日志回调:
void ffmpegErrorCallback(void *ptr, int level, const char *fmt, va_list vargs) {
LOGE("ffmpegErrorCallback Error Occurred! Err: %s", fmt);
}
av_log_set_level(AV_LOG_ERROR);
av_log_set_callback(ffmpegErrorCallback);
FFmpeg 现在会将错误记录为人类可读的消息。它告诉我它找不到
aresample
筛选。这就是我解决问题的方法。
关于c++ - 带有 aecho 的 FFmpeg 过滤器配置无法配置所有链接和格式 - avfilter_graph_config,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65819704/
我正在尝试使用 ldash 等选项和 http_opts ,正如 dash muxer 文档所描述的,但 FFmpeg 无法识别它们。我正在使用最新发布的 ffmpeg v4.2.2 版本。我在 ff
假设我们有许多想要与 -vcodec 副本(或等效语法)合并的视频记录。无需重新编码,不会损失质量。并且很少有记录(minor set),有另外的编解码器,参数等等。所以我们可以使用 ffprobe
有没有办法安装 ffmpeg 没有root访问权限?使用 ./configure 无法做到这一点来自 git 克隆 git://source.FFmpeg.org/fFFmpeg.git 最佳答案 是
在应用程序中直接使用 FFmpeg 与使用 Ffmpeg 命令行有什么区别? 最佳答案 没有:FFmpeg 命令行只是一个使用 FFmpeg API 的应用程序。当然,在使用该应用程序时,您仅限于已实
我正在使用以下命令对文件(下面的媒体信息)进行编码: ffmpeg -i AHomeMovie.mkv -map 0 -c copy -c:v libx264 -preset veryslow -cr
我正在制作一张圣诞贺卡,我需要将视频嵌入到右侧(边框内)的卡片中,并在左侧显示一些文本。 为简单起见,假设我有一个带有透明孔的盒子。我想在那个洞里显示视频。 我正在使用 ffmpeg-python很高
我正在使用 laravel ffmpeg 为视频创建缩略图,但是当我运行代码时,它返回给我 Call to undefined method FFMpeg\FFMpeg::fromDisk() 我不知
我为我的 nvidia 下载了 cuda 驱动程序 但它仍然不使用我的 GPU,它仍然使用 cpu。 我怎样才能让它使用GPU。 我也听说过硬件加速,但那不起作用。 它必须是 h.264 最佳答案 你
尝试剪切视频的多个部分时,我遵循此问题的解决方案 Cut multiple parts of a video with ffmpeg .但问题是,如果我剪切多次(比如大约 20 次或更多),视频和音频
所以我最近开始在我打算在商业上分发的应用程序中实现 ffmpeg。而且我很难理解整个许可过程。 我见过的最常回答的问题似乎是关于 x264,它需要 x264.org 的付费许可才能在商业上使用它(对吗
我使用 ffmpeg 更改视频文件的分辨率,转换到另一个位置后,视频持续 0 秒,但最初持续 2 分钟 我的ffmepg代码: ffmpeg -i input.mp4 -filter:v scale=
如上: FFMPEG 不支持在没有第三部分库的情况下加载外部过滤器是否有特定原因? (像弗莱0r) 我必须重新编译整个包来添加一个新的过滤器! 最佳答案 只有开发人员可以肯定地回答,但我会冒安全风险和
我收到了一个编码器,我需要用 FFMPEG 编译,我是新手,所以我不知道如何用 ffmpeg 添加/编译它。编码器是JSV,我的服务器是ubuntu 14.04。 我已经开始阅读这篇 https://
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许在 Stack Overflow 上提出有关通用计算硬件和软件的问题。您可以编辑问题,使其成为
我正在制作一个利用 ffmpeg 重新混合和转码视频文件的程序。我想使用 ffmpeg -codecs和 ffmpeg -formats (或通过 ffmpeg 可用的任何其他命令)来检查我可以在哪些
这个问题在这里已经有了答案: ffmpeg moving text drawtext (1 个回答) 3年前关闭。 我正在使用此命令使用 ffmpeg 将文本从一个地方移动到另一个地方 ffmpeg
为什么 ffmpeg/ffprobe 为流和整个文件提供不同的比特率值? 当我使用 ffprobe 分析 mp3 文件时,它会在第一行和第二行给出不同的比特率。 有谁知道,有什么区别? // File
如何在ffmpeg中使用drawtext在视频上绘制多色文本? 示例:我想突出句子中的专有名词, “XYZ公司股价上涨91%” 高亮 XYZ 白色 黄色 用绿色突出显示 91% 如果您有任何其他方法不
我想让我的不和谐机器人播放音乐,但我不断收到“找不到 FFMPEG”错误。 我的机器人主要是由 ping 制成的,所以我不会上传那部分。音乐代码应该是这个。 const Discord = requi
我需要帮助在 ffmpeg drawtext 过滤器中正确/(完全)显示德语变音符号“äüö”。我现在不能说我的无能是由于缺乏 ffmpeg 专业知识或机器配置,还是两者兼而有之。非常感谢您的意见。
我是一名优秀的程序员,十分优秀!