分离音频和视频流
虽然我不确定 Stack Overflow 是否是问这个问题的最佳地点,但它是我能想到的最好的地方,看看我的谷歌技能如何让我失望......尽管这个问题并不特定于我认为的任何语言这里的人们应该能够帮助我了解概念和理论。
所以,话虽如此……
我见过很多从 YouTube 视频中提取音频的服务。因为我很好奇用视频编程,所以我认为实现同样的事情将是一种相当有益且简单的介绍方法。
至于该主题的技术细节,我迷失了。我对视频播放的工作原理不太清楚,而且我也不知道如何通过编程来分离这些东西。
感谢您的时间和耐心。
While I'm not sure whether Stack Overflow is the best place to ask this question, its the best I could come up with see how my google skills are failing me... Even though this question isn't specific to any language I think that people here should be able to help fill me in on the concepts and theory.
So, with that said...
I've seen quite a few services that rip the audio from say a youtube video. Seeing as I am curious to program with video and what not I thought achieving the same thing would be a rather beneficial and easy way to be introduced.
As for technical details on the subject I am lost. I don't have a good idea on the nitty gritty of how video play back works, and I am clueless to how one would separate those things through programming.
Thanks for the time and patience.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以通过以下方式使用 VLC 应用程序执行此操作:
just audio
vlc --daemon --ttl 7 --ipv4 "/home/user/song.mp3" :sout='#transcode{acodec=mp3,ab-128 }:std{access=mmsh,mux=asfh,dst=:3333}' :no-sout-rtp-sap :no-sout-standard-sap :sout-
只保留视频
vlc --daemon --ttl 7 -- ipv4 v4l2:///dev/video0 :v4l2-standard=0 :input-slave=alsa:// :sout='#transcode{vcodec=div3,vb=2000,scale=1,acodec=none}:std{ access=mmsh,mux=asfh,dst=:3333}' :no-sout-rtp-sap :no-sout-standard-sap :sout-keep
You can do this with the VLC application in the following way:
just audio
vlc --daemon --ttl 7 --ipv4 "/home/user/song.mp3" :sout='#transcode{acodec=mp3,ab-128}:std{access=mmsh,mux=asfh,dst=:3333}' :no-sout-rtp-sap :no-sout-standard-sap :sout-keep
just video
vlc --daemon --ttl 7 --ipv4 v4l2:///dev/video0 :v4l2-standard=0 :input-slave=alsa:// :sout='#transcode{vcodec=div3,vb=2000,scale=1,acodec=none}:std{access=mmsh,mux=asfh,dst=:3333}' :no-sout-rtp-sap :no-sout-standard-sap :sout-keep
你可以看看TAE, http://github.com/tuna74/TunaAudioExtracter 。请记住,TAE 仅转储音频流,并且仅在必要时进行转码。
You can take a look at TAE, http://github.com/tuna74/TunaAudioExtracter . Please keep in mind that TAE only dumps the audio stream and only does transcoding if necessary.
这是一个相当广泛的问题,但我会尝试一下。基本上有两种方法:
即使您无法对格式进行逆向工程,也可以实现选项 1,但我认为它不是一个流行的选择,因为它很慢,并且需要再次对音频进行编码,从而可能导致质量下降。所以方案2是首选。
我不知道有关 Adobe FLV 流(YouTube 使用的)的详细信息,只知道 FLV 是一种将音频/视频信号组合在单个流中的容器格式。您将必须学习如何解析它们(或找到一个可以为您完成此操作的库)。您还需要找到要读取的 flv 流的 url。为了进行测试,您可以在播放视频后从临时 Internet 文件中读取它。
This is quite a broad question but I'll give it a try. There are basically two approaches:
Option 1 can be implemented even if you can't reverse engineer the format, but I don't think it is a popular choice as it is slow, and requires encoding the audio once more, causing a possible drop in quality. So Option 2 is preferred.
I don't know the details about Adobe FLV streams (which is what YouTube uses), except that FLV is a container format that combines audio/video signals in a single stream. You will have to learn how to parse them (or find a library that will do it for you). You will also need to find the url for the flv stream you want to read. For testing, you can start with reading it from your temporary internet files after you played back the video.