我在尝试使用 . 打开编解码器时遇到错误avcodec_open2()。avi如果我指定而不是在函数h264中指定,我已经尝试了相同的代码,没有任何问题av_guess_format()。
我不知道该怎么办。还有其他人遇到过类似的问题吗?
我正在使用的库是ffmpeg-20160219-git-98a0053-win32-dev。如果您能帮助我摆脱这种困惑,我将非常感激。
这是我的控制台输出:
视频编码
[libx264 @ 01383460] 检测到损坏的 ffmpeg 默认设置
[libx264 @ 01383460] 使用编码预设(例如 -vpre 中)
[libx264 @ 01383460] 预设用法:-vpre -vpre
[libx264 @ 01383460] 速度预设在 x264 中列出--help
[libx264 @ 01383460] 配置文件是可选的;x264 默认为高
无法打开视频编解码器,-542398533
这是我正在使用的代码:
// Video encoding sample
AVCodec *codec = NULL;
AVCodecContext *codecCtx= NULL;
AVFormatContext *pFormatCtx = NULL;
AVOutputFormat *pOutFormat = NULL;
AVStream * pVideoStream = NULL;;
AVFrame *picture = NULL;;
int i, x, y, ret; …Run Code Online (Sandbox Code Playgroud) 我想从RTP流中读取内容,但是当我指定“ test.sdp”时,avformat_open_input()我得到以下消息:
[rtp @ 03928900] Protocol not on whitelist 'file'!
Failed: cannot open input.
avformat_open_input() fail: Invalid data found when processing input
Run Code Online (Sandbox Code Playgroud)
通常,如果我在控制台上使用ffplay,我会添加该选项-protocol_whitelist file,udp,rtp,它将正常工作。
所以我尝试了这个:
AVDictionary *d = NULL;
av_dict_set(&d, "protocol_whitelist", "file, udp, rtp", 0);
ret = avformat_open_input(&inFormatCtx, filename, NULL, &d);
Run Code Online (Sandbox Code Playgroud)
但是,仍然弹出相同的消息。有任何想法吗?
我正在使用 gcc (-std=gnu99) 进行嵌入式工具链 (Myriota) 的开发,但 printf 存在问题。
当我尝试以下代码时:
long long int time = TimeGet();
printf("\nSeconds since epoch: %lld\r\n", time);
Run Code Online (Sandbox Code Playgroud)
它打印:
Seconds since epoch: ld
Run Code Online (Sandbox Code Playgroud)
使用"%" PRId64打印相同的“ld”。
有任何想法吗?如果您能指出我正确的地方,我将不胜感激。
编辑
变量类型已更正long long int time
我正在尝试在我的应用程序中读取音频 RTP 流,但出现此错误:
[pcm_mulaw @ 03390580] PCM channels out of bounds
Run Code Online (Sandbox Code Playgroud)
我可以用 ffplay 很好地读取 RTP 流:
ffplay -i test.sdp -protocol_whitelist file,udp,rtp
Run Code Online (Sandbox Code Playgroud)
我使用以下命令生成 RTP 流:
ffmpeg -re -f lavfi -i aevalsrc="sin(400*2*PI*t)" -ar 8000 -f mulaw -f rtp rtp://127.0.0.1:8554
// SDP
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 57.25.101
m=audio 8554 RTP/AVP 0
b=AS:64
Run Code Online (Sandbox Code Playgroud)
这是我的源代码:
#include "stdafx.h"
#include <math.h>
extern "C"
{
#include <libavutil/opt.h>
#include <libavcodec/avcodec.h>
#include <libavutil/channel_layout.h>
#include <libavutil/common.h>
#include <libavutil/imgutils.h>
#include <libavutil/mathematics.h> …Run Code Online (Sandbox Code Playgroud)