C#录制特定网站的音频 [英] C# recording a specific site's audio

查看:120
本文介绍了C#录制特定网站的音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想记录一个特定网站的音频输出。

现在这里是它的外观像:

我打开一个网站(也许是.NET WebBroswer类?),我可以记录该网站的音频输出,这样我就可以导航到其他网站了。录制,然后我可以播放它。

想象一下它是一首YouTube歌曲下载器。 (当然那不是目的)



或者,如果我可以记录指定应用程序的声音,这也是一种可能的解决方案,因为我打开一个网站然后,每当我按下录制按钮时,它开始记录WebBrowser的按钮。



提前感谢您的答案。

Hi,

I would like to record a specific website''s audio output.
Now here is how it should look like:
I open a website (maybe .NET WebBroswer class?), and I can record that site''s audio output, so I can navigate to other site''s while it''s recording, and then I could play it back.
Imagine it as a YouTube song "downloader". (of course that''s not the purpose)

Or if I could record a specified application''s sound that would be a possible solution too, as I open a website then whenever I press the record button it starts recording that WebBrowser''s button.

Thank you for your answers in advance.

推荐答案

我不想告诉你,但一般情况下这绝对是不可能。我对这个问题的评论应该给你一些提示。



但是,你可以涵盖一些特殊的简单案例,也许是某些特定的网站。例如,如果页面包含背景音乐或只能通过 href 下载音频文件,您只需下载音乐源:

http://www.thesitewizard.com/webdesign/backgroundmusic.shtml [ ^ ]。



在这种简单的情况下,你会需要使用 Web抓取技术, http://en.wikipedia.org/wiki/Web_scraping [ ^ ]。

For更多细节,请看我过去的答案:

从网页获取特定数据 [ ^ ],

如何从其他网站获取数据 [ ^ ]。



有很多更难以覆盖的更难的案例。该网站可以使用音频流并使用许多不同的协议,这些协议难以覆盖,因为它很难全部实现,并且直接下载不可用,因为这不是纯HTTP。有些协议是专有的,没有适当记录,并且会不时修改;一个众所周知的困难案例是Microsoft MMS或HMMS,MMS通过HTTP。例如,FFMpeg可以处理下载这样的流。即使你涵盖了许多协议,你也无法保证使用其他东西。



最后,你可能会好奇为什么我使用如此强烈的表达绝对不可能 。好吧,因为在一般情况下这是如此。该站点可以使用一些伪随机算法,更准确地说,理论上不可预测的音频样本序列;这个想法的另一个变体是自动生成音乐。在计算机科学中有一个非常普遍的定理告诉我们,算法行为的预测在一般情况下理论上是不可能的。 (例如,参见 http://en.wikipedia.org/wiki/Halting_problem [ ^ ]。)而且,在实践中,它更加不可能:-),因为你甚至无法访问这种不可预测的算法;它隐藏在网站的服务器部分...



刮取所有网站的音频输出的一般问题甚至没有意义。



-SA
I hate to tell you that, but in general case this is absolutely impossible. My comment to the question should give you some hint.

However, you can cover some special simple cases, maybe for some specific sites. For example, if the pages contain background music or just downloadable audio files via href, you can simply download music source:
http://www.thesitewizard.com/webdesign/backgroundmusic.shtml[^].

In such simple cases, you would need to use the Web scraping techniques, http://en.wikipedia.org/wiki/Web_scraping[^].
For more detail, please see my past answers:
get specific data from web page[^],
How to get the data from another site[^].

There are much more difficult cases that are really hard to cover. The site can use audio streaming and use many different protocols which are hard to cover just because it''s hard to implement them all, and direct download is not available, because this is not pure HTTP. Some protocols are proprietary, not properly documented and are modified from time to time; one notoriously difficult case is Microsoft MMS or HMMS, MMS via HTTP. For example, FFMpeg can cope with downloading such a stream. Even if you cover many protocols, you cannot guarantee that something else is used.

And finally, you may be curious why I used such strong expression as "absolutely impossible". Well, because this is so in a general case. The site can use some algorithm of pseudo-random, more exactly, theoretically unpredictable sequence of audio samples; another variant of this idea is automatic generation of music. There is a very general theorem in computer science telling us that prediction of algorithm behavior is in general case theoretically impossible. (See for example, http://en.wikipedia.org/wiki/Halting_problem[^].) And, in practice, it''s "even more impossible" :-), because you don''t even have access to such unpredictable algorithm; it is hidden on the server part of the site…

The general problem of scraping of all site''s audio output does not even make sense.

—SA


这篇关于C#录制特定网站的音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆