caprica / vlcj

Java framework for the vlc media player
http://www.capricasoftware.co.uk/projects/vlcj
1.14k stars 260 forks source link

VLC can't recognise the input's format #403

Closed user2006 closed 9 years ago

user2006 commented 9 years ago

I have this code:

String mrl = "https://www.youtube.com/watch?v=9TOXTnSqP7A";
String options = ":sout=#transcode{vcodec=h264,scale=Autom·tico,acodec=mpga,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst=\"C:\\test1.mp4\",no-overwrite},dst=display}";
mediaPlayer.playMedia(mrl, options, ":nooverlay", ":sout-keep", ":run-time=20", ":stop-time=20", "vlc://quit");
mediaPlayer.release();
mediaPlayerFactory.release();

It doesn't fail in terminal and it creates the file, but it's corrupt (only 1KB size) and when I try to open it VLC gives me the error:

VLC can't recognise the input's format: The format of 'file:///C://....mp4' cannot be detected.

Why is it wrong?

caprica commented 9 years ago

Probably the 'corrupt' file is the YouTube HTML page.

Please look in the test sources for the YouTube player to see the correct way to play it. You need to deal with media lists and sub items.

user2006 commented 9 years ago

Youtube link is working fine and if I execute the command from the command line, I can record that. But using that with vlcj doesn't work.

caprica commented 9 years ago

Enable vlcj logs, and VLC logs, and post them.

caprica commented 9 years ago

DId you actually look at the contents of your 1kb corrupted file... some clues might be in there.

caprica commented 9 years ago

Anyway, if you're going to use vlcj like this (that those command-line switches you're using are explicitly not supported by LibVLC), you might as well use Runtime.exec or commons-exec to just execute a VLC process for you.

user2006 commented 9 years ago

These are the logs:

getVlcInstallDir()
0 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.runtime.windows.WindowsRuntimeUtil  - getVlcInstallDir()
vlcj: 3.9.0
188 [AWT-EventQueue-0] INFO uk.co.caprica.vlcj.Info  - vlcj: 3.9.0
java: 1.8.0_60 Oracle Corporation
188 [AWT-EventQueue-0] INFO uk.co.caprica.vlcj.Info  - java: 1.8.0_60 Oracle Corporation
java home: C:\Archivos de programa\Java\jre1.8.0_60
188 [AWT-EventQueue-0] INFO uk.co.caprica.vlcj.Info  - java home: C:\Archivos de programa\Java\jre1.8.0_60
os: Windows XP 5.1 x86
188 [AWT-EventQueue-0] INFO uk.co.caprica.vlcj.Info  - os: Windows XP 5.1 x86
initX=null
203 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - initX=null
vlc: 2.2.1 Terry Pratchett (Weatherwax), changeset 2.2.1-0-ga425c42
203 [AWT-EventQueue-0] INFO uk.co.caprica.vlcj.binding.LibVlcFactory  - vlc: 2.2.1 Terry Pratchett (Weatherwax), changeset 2.2.1-0-ga425c42
libvlc: C:\Archivos de programa\VideoLAN\VLC\libvlc.dll
203 [AWT-EventQueue-0] INFO uk.co.caprica.vlcj.binding.LibVlcFactory  - libvlc: C:\Archivos de programa\VideoLAN\VLC\libvlc.dll
MediaPlayerFactory(libvlc=Proxy interface to Native Library <C:\Archivos de programa\VideoLAN\VLC\libvlc.dll@1783627776>,libvlcArgs=[])
203 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - MediaPlayerFactory(libvlc=Proxy interface to Native Library <C:\Archivos de programa\VideoLAN\VLC\libvlc.dll@1783627776>,libvlcArgs=[])
jna.library.path=null
203 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - jna.library.path=null
VLC_PLUGIN_PATH=null
203 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - VLC_PLUGIN_PATH=null
instance=native@0x3d5c48 (uk.co.caprica.vlcj.binding.internal.libvlc_instance_t@3d5c48)
578 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - instance=native@0x3d5c48 (uk.co.caprica.vlcj.binding.internal.libvlc_instance_t@3d5c48)
equalizerAvailable=true
578 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - equalizerAvailable=true
createEqualizerBandFrequencies()
578 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - createEqualizerBandFrequencies()
numBands=10
578 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - numBands=10
result=[31.25, 62.5, 125.0, 250.0, 500.0, 1000.0, 2000.0, 4000.0, 8000.0, 16000.0]
578 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - result=[31.25, 62.5, 125.0, 250.0, 500.0, 1000.0, 2000.0, 4000.0, 8000.0, 16000.0]
createEqualizerPresetNames()
578 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - createEqualizerPresetNames()
numPresets=18
578 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - numPresets=18
result=[Flat, Classical, Club, Dance, Full bass, Full bass and treble, Full treble, Headphones, Large Hall, Live, Party, Pop, Reggae, Rock, Ska, Soft, Soft rock, Techno]
578 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - result=[Flat, Classical, Club, Dance, Full bass, Full bass and treble, Full treble, Headphones, Large Hall, Live, Party, Pop, Reggae, Rock, Ska, Soft, Soft rock, Techno]
newHeadlessMediaPlayer()
578 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - newHeadlessMediaPlayer()
DefaultMediaPlayer(libvlc=Proxy interface to Native Library <C:\Archivos de programa\VideoLAN\VLC\libvlc.dll@1783627776>, instance=native@0x3d5c48 (uk.co.caprica.vlcj.binding.internal.libvlc_instance_t@3d5c48))
610 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - DefaultMediaPlayer(libvlc=Proxy interface to Native Library <C:\Archivos de programa\VideoLAN\VLC\libvlc.dll@1783627776>, instance=native@0x3d5c48 (uk.co.caprica.vlcj.binding.internal.libvlc_instance_t@3d5c48))
createInstance()
610 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - createInstance()
mediaPlayerInstance=native@0x1436f8b4 (uk.co.caprica.vlcj.binding.internal.libvlc_media_player_t@1436f8b4)
828 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - mediaPlayerInstance=native@0x1436f8b4 (uk.co.caprica.vlcj.binding.internal.libvlc_media_player_t@1436f8b4)
mediaPlayerEventManager=native@0x143a3d18 (uk.co.caprica.vlcj.binding.internal.libvlc_event_manager_t@143a3d18)
828 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - mediaPlayerEventManager=native@0x143a3d18 (uk.co.caprica.vlcj.binding.internal.libvlc_event_manager_t@143a3d18)
registerEventListener()
828 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - registerEventListener()
event=libvlc_MediaPlayerMediaChanged
828 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerMediaChanged
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerNothingSpecial
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerNothingSpecial
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerOpening
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerOpening
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerBuffering
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerBuffering
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerPlaying
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerPlaying
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerPaused
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerPaused
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerStopped
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerStopped
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerForward
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerForward
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerBackward
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerBackward
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerEndReached
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerEndReached
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerEncounteredError
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerEncounteredError
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerTimeChanged
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerTimeChanged
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerPositionChanged
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerPositionChanged
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerSeekableChanged
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerSeekableChanged
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerPausableChanged
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerPausableChanged
result=0
860 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerTitleChanged
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerTitleChanged
result=0
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerSnapshotTaken
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerSnapshotTaken
result=0
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerLengthChanged
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerLengthChanged
result=0
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerVout
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerVout
result=0
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaPlayerScrambledChanged
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerScrambledChanged
result=0
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
playMedia(mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A,mediaOptions=[:sout=#transcode{vcodec=h264,scale=Autom·tico,acodec=mpga,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst="C:\Documents and Settings\Keren\Mis documentos\prova10.mp4",no-overwrite},dst=display}, :nooverlay, :sout-keep, :run-time=20, :stop-time=20, vlc://quit])
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - playMedia(mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A,mediaOptions=[:sout=#transcode{vcodec=h264,scale=Autom·tico,acodec=mpga,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst="C:\Documents and Settings\Keren\Mis documentos\prova10.mp4",no-overwrite},dst=display}, :nooverlay, :sout-keep, :run-time=20, :stop-time=20, vlc://quit])
encodeMrl(mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A)
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaResourceLocator  - encodeMrl(mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A)
MRL does not contain any Unicode characters
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaResourceLocator  - MRL does not contain any Unicode characters
result=https://www.youtube.com/watch?v=9TOXTnSqP7A
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaResourceLocator  - result=https://www.youtube.com/watch?v=9TOXTnSqP7A
playMedia(media=SimpleMedia[mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A,mediaOptions=[Ljava.lang.String;@175e483])
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - playMedia(media=SimpleMedia[mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A,mediaOptions=[Ljava.lang.String;@175e483])
prepareMedia(media=SimpleMedia[mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A,mediaOptions=[Ljava.lang.String;@175e483])
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - prepareMedia(media=SimpleMedia[mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A,mediaOptions=[Ljava.lang.String;@175e483])
setMedia(media=SimpleMedia[mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A,mediaOptions=[Ljava.lang.String;@175e483])
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - setMedia(media=SimpleMedia[mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A,mediaOptions=[Ljava.lang.String;@175e483])
createMediaInstance(media=SimpleMedia[mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A,mediaOptions=[Ljava.lang.String;@175e483])
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - createMediaInstance(media=SimpleMedia[mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A,mediaOptions=[Ljava.lang.String;@175e483])
Treating mrl as a location
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Treating mrl as a location
mediaInstance=native@0x143b4788 (uk.co.caprica.vlcj.binding.internal.libvlc_media_t@143b4788)
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - mediaInstance=native@0x143b4788 (uk.co.caprica.vlcj.binding.internal.libvlc_media_t@143b4788)
mediaOption=:sout=#transcode{vcodec=h264,scale=Autom·tico,acodec=mpga,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst="C:\Documents and Settings\Keren\Mis documentos\prova10.mp4",no-overwrite},dst=display}
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - mediaOption=:sout=#transcode{vcodec=h264,scale=Autom·tico,acodec=mpga,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst="C:\Documents and Settings\Keren\Mis documentos\prova10.mp4",no-overwrite},dst=display}
mediaOption=:nooverlay
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - mediaOption=:nooverlay
mediaOption=:sout-keep
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - mediaOption=:sout-keep
mediaOption=:run-time=20
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - mediaOption=:run-time=20
mediaOption=:stop-time=20
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - mediaOption=:stop-time=20
mediaOption=vlc://quit
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - mediaOption=vlc://quit
registerMediaEventListener()
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - registerMediaEventListener()
event=libvlc_MediaMetaChanged
875 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaMetaChanged
result=0
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaSubItemAdded
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaSubItemAdded
result=0
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaDurationChanged
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaDurationChanged
result=0
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaParsedChanged
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaParsedChanged
result=0
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaFreed
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaFreed
result=0
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaStateChanged
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaStateChanged
result=0
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
event=libvlc_MediaSubItemTreeAdded
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaSubItemTreeAdded
result=0
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=0
mrl(mediaInstance=native@0x143b4788 (uk.co.caprica.vlcj.binding.internal.libvlc_media_t@143b4788))
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - mrl(mediaInstance=native@0x143b4788 (uk.co.caprica.vlcj.binding.internal.libvlc_media_t@143b4788))
mediaChanged(mediaPlayer=uk.co.caprica.vlcj.player.headless.DefaultHeadlessMediaPlayer@4ae4eb,media=native@0x143b4788 (uk.co.caprica.vlcj.binding.internal.libvlc_media_t@143b4788),mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A)
891 [pool-1-thread-1] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - mediaChanged(mediaPlayer=uk.co.caprica.vlcj.player.headless.DefaultHeadlessMediaPlayer@4ae4eb,media=native@0x143b4788 (uk.co.caprica.vlcj.binding.internal.libvlc_media_t@143b4788),mrl=https://www.youtube.com/watch?v=9TOXTnSqP7A)
Raising event for new media
891 [pool-1-thread-1] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Raising event for new media
result=true
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - result=true
play()
891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - play()
after play
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - after play
release()
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - release()
destroyInstance()
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - destroyInstance()
Detach media events...
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Detach media events...
deregisterMediaEventListener()
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - deregisterMediaEventListener()
event=libvlc_MediaMetaChanged
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaMetaChanged
event=libvlc_MediaSubItemAdded
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaSubItemAdded
event=libvlc_MediaDurationChanged
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaDurationChanged
event=libvlc_MediaParsedChanged
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaParsedChanged
event=libvlc_MediaFreed
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaFreed
event=libvlc_MediaStateChanged
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaStateChanged
event=libvlc_MediaSubItemTreeAdded
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaSubItemTreeAdded
Media events detached.
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Media events detached.
Release media...
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Release media...
Media released.
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Media released.
Detach media player events...
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Detach media player events...
deregisterEventListener()
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - deregisterEventListener()
event=libvlc_MediaPlayerMediaChanged
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerMediaChanged
event=libvlc_MediaPlayerNothingSpecial
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerNothingSpecial
event=libvlc_MediaPlayerOpening
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerOpening
event=libvlc_MediaPlayerBuffering
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerBuffering
event=libvlc_MediaPlayerPlaying
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerPlaying
event=libvlc_MediaPlayerPaused
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerPaused
event=libvlc_MediaPlayerStopped
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerStopped
event=libvlc_MediaPlayerForward
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerForward
event=libvlc_MediaPlayerBackward
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerBackward
event=libvlc_MediaPlayerEndReached
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerEndReached
event=libvlc_MediaPlayerEncounteredError
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerEncounteredError
event=libvlc_MediaPlayerTimeChanged
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerTimeChanged
event=libvlc_MediaPlayerPositionChanged
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerPositionChanged
event=libvlc_MediaPlayerSeekableChanged
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerSeekableChanged
event=libvlc_MediaPlayerPausableChanged
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerPausableChanged
event=libvlc_MediaPlayerTitleChanged
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerTitleChanged
event=libvlc_MediaPlayerSnapshotTaken
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerSnapshotTaken
event=libvlc_MediaPlayerLengthChanged
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerLengthChanged
event=libvlc_MediaPlayerVout
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerVout
event=libvlc_MediaPlayerScrambledChanged
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - event=libvlc_MediaPlayerScrambledChanged
Media player events detached.
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Media player events detached.
Release media player...
922 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Release media player...
Media player released.
3891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Media player released.
Shut down listeners...
3891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Shut down listeners...
Listeners shut down.
3891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - Listeners shut down.
release()
3891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.MediaPlayerFactory  - release()
user2006 commented 9 years ago

This is the content of my corrupted file:

screen shot 2015-09-14 at 10 10 28

caprica commented 9 years ago

So what's going on here:

891 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - play()
after play
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - after play
release()
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - release()
destroyInstance()
907 [AWT-EventQueue-0] DEBUG uk.co.caprica.vlcj.player.DefaultMediaPlayer  - destroyInstance()

Your media player is released immediately after you call play, so it all stops and you end up with your truncated movie file.

The problem is in your own code somewhere.

caprica commented 9 years ago

In fact, I should have spotted that earlier from your original post.

mediaPlayer.playMedia(mrl, options, ":nooverlay", ":sout-keep", ":run-time=20", ":stop-time=20", "vlc://quit");
mediaPlayer.release();

playMedia kicks off the video asynchronously and returns immediately.

You are supposed to use events to wait for the video to finish, or you can search the vlcj Javadoc and test sources for the "Condition" classes.