av_open_input_file 返回 -2 但文件存在(NS2 中的 libav)
我尝试在 NS2 中进行模拟,其中读取 .wav 文件,编码为 gsm 并通过网络发送它们。我已经成功制作了一个读取 .wav、编码为 gsm 并存储在硬盘上的应用程序(经过测试,工作正常)。现在我尝试对 Network Simulator 2 进行相同的扩展,但 av_open_input_file 出现问题,它不断地说没有这样的文件,尽管我在 gsm 编码应用程序中对该文件没有任何问题。我使用的调用:
av_open_input_file(&pFormatCtx, "/home/xxx/audio_samples/audio.wav", NULL, 0, NULL);
已经尝试了不同的文件,对路径、绝对路径、相对路径进行硬编码,并将“file://”放在前面,因为 libav 显然使用某种文件协议。然后我尝试自己打开文件:(
int desc = open("/home/xxx/audio_samples/audio.wav", O_RDONLY, 0);
在 libav 的 file.c 中发现这个调用,应该由 av_open_input_file 调用)打开这样的文件没有问题,一切似乎都很好,所以现在我不知道是什么否则可能是错误的。
有什么建议吗?
此致, 弗洛伦卡
I try to make a simulation in NS2 in which i read in .wav files, encodes into gsm and send them over the network. I already managed to make an application that reads in .wav, encodes into gsm and stores on the hard drive (tested, works fine). Now i try to do the same extending the Network Simulator 2 and i have a problem with av_open_input_file which constantly says there is no such file, although i had no problems with that file in my gsm encoding application. The call i use:
av_open_input_file(&pFormatCtx, "/home/xxx/audio_samples/audio.wav", NULL, 0, NULL);
Already tried different files, hardcoding the path, absolute path, relative path and putting "file://" in front because libav apparently uses some sort of file protocol. Then I tried opening the file myself with:
int desc = open("/home/xxx/audio_samples/audio.wav", O_RDONLY, 0);
(found this call in file.c of libav that is supposed to be called by av_open_input_file) No problems with opening the file like that, everything seems to be ok, so now i have no idea what else could be wrong.
Any suggestions?
Best regards,
florencka
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题解决了。在调用 av_open_input_file 之前缺少 av_register_all()。但没有任何警告或错误。
Problem solved. av_register_all() was missing before calling av_open_input_file. There was no warning or error though.