问题描述
在使用jmf解决了异常之后,请访问如何删除nullpointerexception .我现在可以播放我的视频,但只能在此网站上的.mov文件此处.
After struggling through exceptions in using jmf, on How do I remove nullpointerexception. I am able to now play my video, but only the .mov file here at this website.
但是我正在使用ffmpeg
使用图像和.wav
音频文件来创建视频文件.
But I am creating my video file using ffmpeg
using images and .wav
audio files.
我可以以任何格式创建它,.avi
,.mov
,.mp4
,但是重要的是我应该能够在使用JMF构建的播放器中播放它.
I can create it in any format, .avi
, .mov
, .mp4
, but what is important is I should be able to play it in my player, which I built using JMF.
当前,我收到此错误,
Unable to handle format: FMP4, 1366x768, FrameRate=30.0, Length=3147264 0 extra bytes
java.lang.NullPointerException
at java.awt.Container.addImpl(Unknown Source)
at java.awt.Container.add(Unknown Source)
at javax.swing.JFrame.addImpl(Unknown Source)
at java.awt.Container.add(Unknown Source)
at mediaPlayer.<init>(mediaPlayer.java:31)
at mediaPlayer.main(mediaPlayer.java:38)
这里没有例外,这不是问题,因为播放器可以在该站点上lunarphases.mov
正常工作.
The exceptions here are not the problem, since the player works fine with lunarphases.mov
on that site.
问题是
如何编码视频,以便我的jmf媒体播放器可以播放并处理格式?
How do I encode the video so that my jmf media player can play it and handle the format?
感谢您的所有帮助,非常感谢您为我解决这个问题所做的所有努力. :)
Thanks for all your help and I really appreciate all your efforts you would put on this problem for me. :)
推荐答案
我有一个非常相似的项目,其中使用jmf
播放视频文件.我只是使用了.mov
文件.所以我可以建议您有关.mov的信息.您可以稍后再将其转换为.avi.
I had a very similar project where I used jmf
to play video file. I just used the .mov
file. So I can suggest you about .mov. You may convert it later to .avi again.
这是您可以在jmf中播放.avi视频的方法,据我估计,这将适用于所有类型的.avi视频.您的担心是要拥有高质量的视频,它将为您提供高质量的视频.
Here is what you can do to play your .avi video in jmf, As far as I guess, this would work for all type of .avi videos. Your concern is to have a good quality video, it will give you a good quality video.
这是诀窍
您首先要对视频进行编码,无论采用哪种方式.您可以设置比特率,以所需的方式对所有帧进行帧化.
You first encode the video, whatever way you want to do it. You can set the bitrate, framerate everything the way you want to, the way you want to.
尝试使用jmf播放视频,由于支持jmf格式的.然后根据此站点对其进行编码.
Try running the video with jmf, it may not run due to limited support of formats by jmf. Then encode it according to this site.
现在,相同的代码可以在jmf
视频播放器中运行视频,而不会出现任何问题.
The same code would now run the video in jmf
video player without any problem.
Robodob在上述答案中也指出了同样的观点,
The same is what Robadob pointed too in the above answer,
ffmpeg -i input.avi -vcodec mjpeg -acodec pcm_s16be -ac 2 -y output.mov
是的,它给我带来了糟糕的视频质量,因此请通过提供不同的比特率对其进行编码,
Yes, it gave me a terrible quality video, so encode it by giving a different bit rate,
ffmpeg -i input.avi -vcodec mjpeg -acodec pcm_s16be -ac 2 -y -b:v 5000k output.mov
这将为您提供质量更好的.mov
视频.
This would give you a better quality .mov
video.
希望这会有所帮助:).
Hope this helps:).
这篇关于哪种类型的.avi视频jmf播放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!