无法找到音频流
我正在尝试在 ffmpeg 和 directshow 的帮助下调整代码以添加声音捕获功能(在实时流上)。
当我尝试使用 ffplay 播放 AVIsynth 文件时,一切正常,我已经获得了音频和视频。但是当我通过代码打开这个输入文件时,我只找到视频流。
Avs 文件:
V = DirectShowSource("Decklink_HDMI.grf", fps=10, framecount=1000000000, seek=false, audio=false)
A = DirectShowSource("Decklink_Audio.grf", fps=1, framecount=1000000000, video=false)
AudioDub(V, A)
打开代码:
ffmpeg::AVInputFormat * ifmt;
ifmt = ffmpeg::av_find_input_format("avs");
// Open input file
if(ffmpeg::avformat_open_input(&pFormatCtx, filename.toStdString().c_str(), ifmt, NULL) != 0)
当我在打开后在 gdb 上进行变量查找时。
我正在查看 pFormatCtx->nb_streams 中的 nb_streams,它的值为 1 我可以在 pFormatCtx->stream 中找到的唯一流是视频流。这就是为什么我无法捕捉到声音。
所以我想问一下我的开头是否做错了什么或者我是否错过了什么。
Ps:我知道显示的代码很短,但问题就出现在这一步!
谢谢
库尔特
- 编辑 -
我还注意到,当我转储 AVFormatContext 时,视频流的大小为 456x32。 当我尝试使用 ffplay 启动损坏的脚本时,我可以发现显示的窗口大小完全相同。
当我用 ffplay 播放正确的脚本时,原始视频格式是 1920x1080
我认为我的问题可能比无法获取音频流的简单事实更深刻。
我试图找出如何知道这个 456x32 窗口上显示的错误消息
- EDIT2 -
我找出这个图像上写的内容,我的问题解决了,错误放置的 avs 脚本,旧的已经放置。
我很羞愧。
I'm trying to adapt a code in order to add a sound capture feature (on a live stream), with the help of ffmpeg and directshow.
When i try to play with ffplay the AVIsynth file, everything works perfectly i've got the audio and video. But when i open this input file by code i only find the video stream.
The Avs file :
V = DirectShowSource("Decklink_HDMI.grf", fps=10, framecount=1000000000, seek=false, audio=false)
A = DirectShowSource("Decklink_Audio.grf", fps=1, framecount=1000000000, video=false)
AudioDub(V, A)
The opening code :
ffmpeg::AVInputFormat * ifmt;
ifmt = ffmpeg::av_find_input_format("avs");
// Open input file
if(ffmpeg::avformat_open_input(&pFormatCtx, filename.toStdString().c_str(), ifmt, NULL) != 0)
When i make a variable lookout on gdb just after the opening.
i'm looking at nb_streams in pFormatCtx->nb_streams and it's at 1
The only stream i can find in pFormatCtx->stream is a video one. And that's why i'm not able to capture the sound.
So i'm asking if i'm doing something wrong with my opening or if i miss something.
Ps : I know the code shown is short but the problem appears at this very step !
Thank you
Kurt
-- EDIT --
I've also noticed that when I dump the AVFormatContext the video stream got a 456x32 size.
And i can find this very same size of the window displayed when i try to launch a corrupted script with ffplay.
The original video format when i play the correct script with ffplay is of 1920x1080
I think my problem is maybe deeper than the simple fact of not being able to get the audio stream.
I'm trying to find out how to know the error message that is displayed on this 456x32 windows
-- EDIT2 --
I Find out what is written on this image and my problem is solved, badly placed avs script an old one was is place.
I'm ashamed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的错,
AVS 文件放置不当是我的问题。
无论如何,ffmpeg 在显示错误的方式上有点痛苦,被迫制作快照而没有任何错误消息或引发异常(或者可能是我失败了)。
My bad,
A badly placed avs file was my problem.
Anyway ffmpeg is a bit painful in his way of showing error, being forced to make a snapshot without any error msg or exception raised (or maybe did i failled).