Javafx媒体播放器不播放视频

 2023-02-16    378  

问题描述

使用OpenJFX 11我正在使用MediaPlayer在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

这是无效的信息:

Javafx媒体播放器不播放视频

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时,我还升级了OS,因此也可能是一些丢失的编解码器.

  1. 我将如何用声音编码视频,以便使用javafx MediaPlayer?
  2. 播放.

  3. 如果在某些操作系统上需要提供其他编解码器,则如这个旧文章,如何使用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

推荐答案

事实证明,虽然MP3被支持为音频,但不支持视频,至少没有开箱即用.

通过MP4和AAC进行音轨.至少对于Java 11,Linux Mint 18.3上的OpenJFX 11是正确的.

以上所述是小编给大家介绍的Javafx媒体播放器不播放视频,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持!

原文链接:https://77isp.com/post/33911.html

=========================================

https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。