使用OpenJFX 11
我正在使用媒体播放器在Linux系统上播放一些剪辑。其中一些显示,其他不显示。据我所知,编码的唯一区别是未播放的视频包含音轨。
这是播放的视频的mediainfo
的输出:
General
Complete name : OpenPatricianData/src/main/resources/video/event/BlackDeath.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 26.0 MiB
Duration : 30s 0ms
Overall bit rate : 7 265 Kbps
Encoded date : UTC 1904-01-01 00:00:00
Tagged date : UTC 1904-01-01 00:00:00
Writing application : Lavf54.63.104
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 30s 0ms
Bit rate : 7 264 Kbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 24.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.146
Stream size : 26.0 MiB (100%)
Writing library : x264 core 142 r2389 956c8d8
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 1904-01-01 00:00:00
Tagged date : UTC 1904-01-01 00:00:00
这是不起作用的信息:
General
Complete name : OpenPatricianData/src/main/resources/video/event/fire.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 30.4 MiB
Duration : 19s 368ms
Overall bit rate : 13.2 Mbps
Encoded date : UTC 1904-01-01 00:00:00
Tagged date : UTC 1904-01-01 00:00:00
Writing application : Lavf54.63.104
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 19s 334ms
Bit rate : 12.9 Mbps
Nominal bit rate : 40.0 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 24.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.260
Stream size : 29.8 MiB (98%)
Writing library : x264 core 142 r2389 956c8d8
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=0 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=40000 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 1904-01-01 00:00:00
Tagged date : UTC 1904-01-01 00:00:00
Audio
ID : 2
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Mode : Joint stereo
Codec ID : 6B
Duration : 19s 368ms
Bit rate mode : Constant
Bit rate : 256 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 605 KiB (2%)
Default : Yes
Alternate group : 1
Encoded date : UTC 1904-01-01 00:00:00
Tagged date : UTC 1904-01-01 00:00:00
没有记录或显示任何错误消息。
如果我没记错的话,以前在版本8中使用JavaFX时,这种方法已经奏效。此后,我还升级了操作系统,因此也可能缺少一些编解码器。
MediaPlayer
播放视频?Maven
项目执行此操作?我不希望用户要求手动安装其他库,以便我的应用程序可以正常工作。 [编辑:]
可能与libavcodec有关的是sudo find / -name 'libavcodec*'
返回的列表:
/var/lib/dpkg/info/libavcodec-dev:amd64.list
/var/lib/dpkg/info/libavcodec-ffmpeg56:amd64.list
/var/lib/dpkg/info/libavcodec-ffmpeg56:amd64.shlibs
/var/lib/dpkg/info/libavcodec-ffmpeg56:amd64.symbols
/var/lib/dpkg/info/libavcodec-dev:amd64.md5sums
/var/lib/dpkg/info/libavcodec-ffmpeg56:amd64.triggers
/var/lib/dpkg/info/libavcodec-ffmpeg56:amd64.md5sums
/var/cache/apt/archives/libavcodec-ffmpeg56_7%3a2.8.14-0ubuntu0.16.04.1_amd64.deb
/var/cache/apt/archives/libavcodec-dev_7%3a2.8.15-0ubuntu0.16.04.1_amd64.deb
/var/cache/apt/archives/libavcodec-ffmpeg56_7%3a2.8.15-0ubuntu0.16.04.1_amd64.deb
/var/cache/apt/archives/libavcodec-dev_7%3a2.8.14-0ubuntu0.16.04.1_amd64.deb
/usr/lib/vlc/plugins/codec/libavcodec_plugin.so
/usr/lib/x86_64-linux-gnu/libavcodec-ffmpeg.so.56
/usr/lib/x86_64-linux-gnu/libavcodec.so
/usr/lib/x86_64-linux-gnu/libavcodec-ffmpeg.so.56.60.100
/usr/lib/x86_64-linux-gnu/libavcodec-ffmpeg.a
/usr/lib/x86_64-linux-gnu/libavcodec.a
/usr/lib/x86_64-linux-gnu/libavcodec-ffmpeg.so
/usr/lib/x86_64-linux-gnu/pkgconfig/libavcodec-ffmpeg.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/libavcodec.pc
/usr/share/doc/libavcodec-ffmpeg56
/usr/share/doc/libavcodec-dev
/usr/share/lintian/overrides/libavcodec-ffmpeg56
/usr/include/x86_64-linux-gnu/libavcodec
答案 0 :(得分:2)
事实证明,虽然MP3支持作为音频,但视频不支持MP3,至少对于Linux来说不是开箱即用的。
通过MP4和AAC一起运行的音轨才有效。至少对于Linux Mint 18.3上的Java 11,OpenJFX 11来说确实如此。