JavaFX媒体播放器不播放视频

问题描述 投票:3回答:1

使用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。从那时起我也升级了操作系统,因此它也可能是一些缺少的编解码器。

  1. 我如何编码带声音的视频,以便使用JavaFX MediaPlayer播放?
  2. 如果在某些操作系统上,需要提供额外的编解码器,如this old article所示,如何使用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
java javafx media-player codec
1个回答
2
投票

事实证明,虽然支持MP3作为音频,但视频不支持它,至少Linux不是开箱即用的。

可以解决的是MP4和AAC用于音频轨道。至少在Linux Mint 18.3上的Java 11,OpenJFX 11中也是如此。

© www.soinside.com 2019 - 2024. All rights reserved.