Page 1 of 1

[VLCJ] Don't get info of video file !!!

Posted: 26 Sep 2013 08:21
by dehin
I am trying to get info about codecs of video file.
Can you explain to me terms "Track", "Title", "Chapter", "Track Info", "Track Description".

I run "https://github.com/caprica/vlcj/blob/ma ... oTest.java" with my file "C:\\video.avi"
Output:

Code: Select all

Track Information: [VideoTrackInfo[codec=0x43435354,codecName=TSCC,originalCodec=0x0,originalCodecName=null,id=0,profile=-1,level=-1,bitRate=0,language=null,description=null][width=800,height=600,sampleAspectRatio=0,sampleAspectRatioBase=0,frameRate=0,frameRateBase=0], UnknownTrackInfo[codec=0x0,codecName=null,originalCodec=0x0,originalCodecName=null,id=-1,profile=1,level=22050,bitRate=0,language=null,description=null]] Title Descriptions: [] Video Descriptions: [TrackDescription[id=-1,description=Vô hiệu], TrackDescription[id=0,description=Track 1]] Audio Descriptions: [TrackDescription[id=-1,description=Vô hiệu], TrackDescription[id=1,description=Track 1]]
Why "profile=-1,level=-1,bitRate=0,language=null,description=null" ....

Method getAspectRatio() also return null...

Can anyone help me ??? Thanks!

Re: [VLCJ] Don't get info of video file !!!

Posted: 26 Sep 2013 18:29
by sherington
Can you explain to me terms "Track", "Title", "Chapter", "Track Info", "Track Description".
Well superficially a Track refers to an audio/video/spu track contained in the media. Chapter and Title refer at least to DVD media (a single DVD can have many titles, each title can have many chapters).

For "Track Info", the API says this:
Get the track (i.e. "elementary streams") information for the current media.
For "Track Description", it's basically an integer track identifier (used e.g. to select audio/video/spu tracks), and a textual description *if available* (e.g. "English").
I run "https://github.com/caprica/vlcj/blob/ma ... oTest.java" with my file "C:\\video.avi"
Why "profile=-1,level=-1,bitRate=0,language=null,description=null" ....
I suppose because that information is not available at all, or not available yet, for your particular media.
Method getAspectRatio() also return null...
This function will only return something if you invoked setAspectRatio() first.

If you want the actual aspect ratio from the media itself, then the new version of vlc (I forget exactly when this was added) adds some extra track information which *might* be relevant.

If I run the latest vlc, and the latest vlcj, I see debug output like this:

Code: Select all

Title Descriptions: [] Video Descriptions: [TrackDescription[id=-1,description=Disable], TrackDescription[id=0,description=Track 1]] Audio Descriptions: [TrackDescription[id=-1,description=Disable], TrackDescription[id=1,description=Track 1]]
And

Code: Select all

AUDIO: [AudioTrackInfo[codec=0x6167706d,codecName=mpga,originalCodec=0x6167706d,originalCodecName=mpga,id=1,profile=0,level=0,bitRate=112000,language=null,description=null][channels=2,rate=48000]] VIDEO: [VideoTrackInfo[codec=0x7634706d,codecName=mp4v,originalCodec=0x44495658,originalCodecName=XVID,id=0,profile=0,level=0,bitRate=0,language=null,description=null][width=512,height=288,sampleAspectRatio=1,sampleAspectRatioBase=1,frameRate=30000,frameRateBase=1001]]
Sometimes you have to wait a bit after playing before this information becomes available. Sometimes some of the information is simply not available. What I have seen is that with different (types of) media some or other of this information is available at different times.

Personally, I tend to use the Linux "mediainfo" tool to get the media information rather than vlc.

Re: [VLCJ] Don't get info of video file !!!

Posted: 26 Sep 2013 20:08
by dehin
Thanks for your help !
I am building a simple video editor with functions : merge 2 video file, cut videos, insert a video into another video, extract audio from video.
I searched google and decided to use VLCJ.
Up to now, I have made a simple video player using VLCJ... and it is very difficult to get tutorial about : libvlc options, process video,...
Does VLCJ support to make a video editor ?
Can you recommend me a direction about my problem ? Thanks!!!

Re: [VLCJ] Don't get info of video file !!!

Posted: 26 Sep 2013 20:43
by sherington
I am building a simple video editor with functions : merge 2 video file, cut videos, insert a video into another video, extract audio from video.
Does VLCJ support to make a video editor ?
Can you recommend me a direction about my problem ?
Well, you can do some of those things with vlcj with various degrees of success and difficulty.

Extracting audio from video is very easy. For the sort of application you're considering maybe a lower level library would suit you better, but it would of course be more difficult.

Your choices are pretty limited if you're using Java - maybe look at xuggler, but that project is on haitus right now as far as I can recall, or try a Java binding to ffmpeg. I've written lots of vlcj applications, but I think of it more as a media player framework, rather than a video editor.

So in theory it might be possible, but I suspect in practice it will be pretty frustrating and limiting with regards to video editing.