VOD mkv with all tracks ( audio and subs )

About encoding, codec settings, muxers and filter usage
kccrocher
New Cone
New Cone
Posts: 1
Joined: 05 Nov 2017 22:02

VOD mkv with all tracks ( audio and subs )

Postby kccrocher » 05 Nov 2017 22:26

Bonjour,
Voici un bon moment que je fais pas mal de recherche sur comment utiliser la librairie vlcj ( vlc avec java ).
J'ai réussi a trouver le moyen pour faire de la VOD ( video a la demande )
Mais malheureusement je n'arrive pas récupérer les sous titres sur cette vod =\
voici le code que j'utilise.

Pour envoyer le film en VOD

Code: Select all

public void ess() throws Exception { String media = "Chemin du media .mkv"; MediaPlayerFactory factory = new MediaPlayerFactory(); MediaManager manager = factory.newMediaManager(); manager.addVideoOnDemand("momie",media, true, null); System.out.println("momie: " + manager.show("momie")); Thread.currentThread().join(); // Don't exit }
pour lire les informarions

Code: Select all

public void start(Film film){ try{ film_playing_info = film; mediaPlayerComponent.getMediaPlayer().playMedia(film_playing_info.getPath()); Date d = Calendar.getInstance().getTime(); while(!parsed){ try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } Date d2 = Calendar.getInstance().getTime(); Map<TimeUnit,Long> mmappeurTimer = computeDiff(d,d2); System.out.println(mmappeurTimer.get(TimeUnit.MINUTES)); if(mmappeurTimer.get(TimeUnit.MINUTES) > 1){ break; } System.out.println("WAIT"); } if(justforinfomedia){ EmbeddedMediaPlayer mediaPlayer = mediaPlayerComponent.getMediaPlayer(); System.out.println("OK"); mediaPlayer.getSpu(); List<TrackDescription> audioTracks = mediaPlayer.getAudioDescriptions(); List<TrackDescription> spuTracks = mediaPlayer.getSpuDescriptions(); List<Track> elemSub = new ArrayList<Track>(); List<Track> elemAudio = new ArrayList<Track>(); if( spuTracks.size() > 0){ for(int i = 0; i < spuTracks.size(); i++){ if(spuTracks.get(i).id() != -1){ Track t = new Track(); t.setId(spuTracks.get(i).id()); t.setName(spuTracks.get(i).description().toString()); elemSub.add(t); } } } if( audioTracks.size() > 0){ for(int i = 0; i < audioTracks.size(); i++){ if(audioTracks.get(i).id() != -1){ Track t = new Track(); t.setId(audioTracks.get(i).id()); t.setName(audioTracks.get(i).description().toString()); elemAudio.add(t); } } } long video= mediaPlayer.getLength(); long Heures = TimeUnit.MILLISECONDS.toHours(video); long minutes = TimeUnit.MILLISECONDS.toMinutes(video) - (Heures * 60); long secondes = TimeUnit.MILLISECONDS.toSeconds(video) - (Heures * 3600) - (minutes*60) ; film_playing_info.setTime( Heures + ":"+ minutes+ ":"+secondes); film_playing_info.setSubtitles(elemSub); film_playing_info.setAudio(elemAudio); mediaPlayer.stop(); mediaPlayer.release(); dispose(); } }catch(Exception e){ e.printStackTrace(); } }
La variable parsed et mise a jour par cette event

Code: Select all

@Override public void mediaParsedChanged(MediaPlayer mediaPlayer, int newStatus) { // TODO Auto-generated method stub. if(justforinfomedia){ parsed = true; } }
Voila si vous avez des idées je suis preneur =)
Merci d avance

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: VOD mkv with all tracks ( audio and subs )

Postby Jean-Baptiste Kempf » 28 Nov 2017 13:59

Les sous-titres sont dans le mkv?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 18 guests