在Java的vlcj播放中,扩展.wav文件时出现口吃问题。

huangapple go评论80阅读模式
英文:

Stuttering in java vlcj playback of expanding wav files

问题

我在Java中使用vlcj来播放被其他服务扩展的wav文件。我的问题是以下的:

当我打开一个音频文件时,播放器知道持续时间是x秒。如果它到达末尾,它必须重新打开(player.controls().start())文件以了解扩展的持续时间。这个重新启动会导致播放时微小的停顿(大约0.1秒),但是可以听到,如果扩展过程很慢,那么停顿可能每2秒发生一次。

我无法修改底层架构的方式,所以无法使用流式传输。

经过数小时的研究后,我认为主要问题是vlcj没有提供手动更新播放的音频文件的持续时间的方式(我可以通过文件大小来计算)(我猜它在打开时加载到内存中)。

有人尝试过成功实现这种播放方式吗?

英文:

I'm using vlcj in java to playback wav files, that are being expanded by other services. My problem is the following:

when I open an audio file the player knows that the duration is x sec. If it reaches the end it has to reopen (player.controls().start()) the file to know the expanded duration. This restart causes a micro stutter in playback (like 0.1 second) but it can be heard, and if the expanding process is slow than the stuttering can happen like every 2 seconds.

I have no way to modify the underlying architecture, so i can not use streaming.

The main issue as I see after hours of research is that vlcj do not provide a way to manually update the duration (that i can calculate by the file size) of the played audio file (it probably loads it to memory on open i guess).

Does somebody tried to implement this kind of playback with success?

答案1

得分: 1

经过对这个主题的深入研究,我得出结论,使用上述描述的设置无法实现无卡顿的播放。它可以进行很大程度的优化,但永远不会完美。问题的根本在于播放的wav文件的长度(持续时间)无法手动设置,因此必须重新加载以重新扫描。

我的解决方案是在存储和客户端之间实现一个 live555 RTSP流媒体服务器。vlcj播放器连接到rtsp流并无缝播放(扩展的)文件。缺点是播放时间需要特定的处理,并且性能较差(对事件的响应较慢)。

英文:

After extended research in the topic I concluded that stutterless playback with the above described setup cannot be achieved. It can be optimized greatly, but will never be perfect. The root of the problem is that the length (duration) of the played wav file cannot be set manually, thus reload is a must for rescan.

My solution for this was to implement a live555 RTSP streaming server between the storage and the client. The vlcj player connects to the rtsp stream and plays the (expanding) file seamlessly. The drawbacks are that the playtime needs specific handling, and has less performance (slower response to events).

huangapple
  • 本文由 发表于 2020年8月4日 16:36:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/63243073.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定