“按需”写入 .Ts 文件; (通知?...)
我有一个只能读取 samba 共享文件的媒体播放器。我想播放http流(例如从我的dreambox)。
我的想法是在我的linux 上共享一个文件夹。在此共享中,我将为我想要观看的每个电视频道放置一个(假的?)文件(例如:channel1.ts、channel2.ts ...)。
媒体播放器只能读取这些文件,就像读取常规文件一样。我的需要:做一些“监听”对这些文件的访问的操作,以便当我的媒体播放器访问它时,它会触发 mencoder -oac copy -ovc copy -o channel1.ts http://path.to.the.broadcast.ts。
我尝试在空文件上使用 inotify 。它很好地触发了 mencoder,但媒体播放器在编码开始之前停止(因为文件是空的,所以它在开始之前到达末尾)。也许,必须填充 5 秒的视频才能缓冲读取?
使用“fifo”可能会很好 =>我尝试过,媒体播放器等待,当我执行 mencoder 时,fifo 开始增长,媒体播放器播放它!是啊!!!...但是 inotify 似乎对 fifo 没有反应...所以我无法自动触发 mencoder。
欢迎提出任何建议。
基本要点:
- 媒体播放器只能读取常规文件
- 文件必须位于 samba 共享文件夹中
- 记录必须按需“触发”(当 mediaplater 尝试访问它时)
- 最好观察“不活动”以停止记录/清空缓冲文件
将这个问题形式化并不容易。我有点失望,我什至不知道我可以通过谷歌进行什么样的搜索。
希望这里的一些大师能找到一些方法来解决这个问题,
干杯。
I have a mediaplayer that can only read samba shared files. I would like to play http stream (from my dreambox for instance).
My idea is to share a folder on my linux. In this share, I will put a (fake?) file for each tv channel I want to be able to watch (ex : channel1.ts, channel2.ts ...).
The mediaplayer can only read these file as it should with regular files. My need : do something that "listen" for access on these files so that when my mediaplayer access it, it fires a mencoder -oac copy -ovc copy -o channel1.ts http://path.to.the.broadcast.ts.
I tried using inotify on an empty file. It fires the mencoder well BUT the mediaplayer stops before encoding starts (because the file is empty so it reaches the end before it starts). Perhaps, have to fill 5s of video in order to buffer the read ?
Could be nice to use a "fifo" => I tried it, the mediaplayer waits, when I do the mencoder, the fifo starts growing, the mediaplayer plays it ! Yeahh !!!... BUT inotify seems not to react on a fifo... so I can't fire mencoder automatically.
Every suggestions welcome.
Basic points :
- The media player can ONLY reads regular files
- File must be in a samba shared folder
- Record must be "fired" on demand (when mediaplater try to access it)
- Could be nice to watch for "inactivity" in order to stop recording / emptying buffer file
It is not easy to formalise this question. I am a bit disapointed and I even't don't know what kind of search I could googelise for that.
Hope some gurus here will find something to do the trick
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要了解分层存储管理和按访问病毒扫描程序使用的技术,因为它们需要在正常访问之前执行类似的中断操作。
例如,使用Talpa 拦截所选目录中的打开操作,并替换此时的文件。
You might want to look at the techniques Hierarchical Storage Management and on-access Virus Scanners use, as they need to do similar interruption before the normal access.
e.g. Use Talpa to intercept open operations in the selected directory, and replace the file at that point.