a-schild / jave2

The JAVE (Java Audio Video Encoder) library is Java wrapper on the ffmpeg project
GNU General Public License v3.0
1.2k stars 245 forks source link

could Jave add ffprobe support? #184

Closed naffan2014 closed 2 years ago

naffan2014 commented 2 years ago

my situation is mp4 have not correct audio info .same like my issue #177 .

for example , mp4 have audio stream ,but audio have wrong duration.

ffprobe 1_1635074333\&62179_1635073851_1635074154.mp4 -show_streams
ffprobe version 4.4-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2007-2021 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[aac @ 0x7f9236008200] Input buffer exhausted before END element found
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1_1635074333&62179_1635073851_1635074154.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2021-10-24T11:15:54.000000Z
    com.android.version: 9
  Duration: 00:04:59.46, start: 0.000000, bitrate: 2013 kb/s
  Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2021-10-24T11:15:54.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]
  Stream #0:1(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720, 2010 kb/s, SAR 1:1 DAR 16:9, 26.18 fps, 24 tbr, 90k tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2021-10-24T11:15:54.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
[STREAM]
index=0
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=16000
channels=1
channel_layout=mono
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/16000
start_pts=0
start_time=0.000000
duration_ts=2
duration=0.000125    // look this duration is something wrong.
bit_rate=128000
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=1
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2021-10-24T11:15:54.000000Z
TAG:language=eng
TAG:handler_name=SoundHandle
TAG:vendor_id=[0][0][0][0]
[/STREAM]
[STREAM]
index=1
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=Constrained Baseline
codec_type=video
codec_tag_string=avc1
codec_tag=0x31637661
width=1280
height=720
coded_width=1280
coded_height=720
closed_captions=0
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=31
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=unknown
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=24/1
avg_frame_rate=141102000/5390317
time_base=1/90000
start_pts=9
start_time=0.000100
duration_ts=26951585
duration=299.462056
bit_rate=2010481
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=7839
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2021-10-24T11:15:54.000000Z
TAG:language=eng
TAG:handler_name=VideoHandle
TAG:vendor_id=[0][0][0][0]
[/STREAM]

In #177 u tell me to use

MultimediaObject object = new MultimediaObject(source);
MultimediaInfo mo = object.getInfo();

i used, but mo.getAudio() not null , have right infos. Then i want use ffprobe to checkout duration info, but Jave have not ffprobe command . Could u add ffprobe feature support?

a-schild commented 2 years ago

Adding ffprobe would almost double the size of the native jar's, since we will have to ship one more binary per platform. I think it would be better to enhance the MultimediaObject to do more work.

Pull requests welcome

naffan2014 commented 2 years ago

As i known , if only use ffmpeg executeble cannot get more information about audio and video,so if not add ffprobe i can not do my work easily by enhance the MultimediaObject. But like u said , it exaclty doube size of the jar's . however if the need more and more about ffprobe , u may consider if add ffprobe in .

a-schild commented 2 years ago

I think it would be possible to create new jars for the ffprobe native jars and have them as optional dependencies....