No embedded subtitles when playing HDR video
I have this very simple app that just play a video, when video has HDR(DDP5.1.HDR.H.265-AGLET.mkv) embedded subtitles are not displayed at all is there some additional setting i should set in order to have embedded subtitles together with HDR video?
package com.example.myapplication
import android.content.Context
import android.media.AudioManager
import android.net.Uri
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.getSystemService
import org.videolan.libvlc.LibVLC
import org.videolan.libvlc.Media
import org.videolan.libvlc.MediaPlayer
import org.videolan.libvlc.util.VLCVideoLayout
import java.io.File
import org.videolan.libvlc.util.DisplayManager;
import java.net.URI
class MainActivity : AppCompatActivity() {
private var mLibVLC: LibVLC? = null
private var mMediaPlayer: MediaPlayer? = null
private var videoLayout: VLCVideoLayout? = null
lateinit var displayManager: DisplayManager
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var args: ArrayList<String> = ArrayList<String>();
args.add("--audio-time-stretch")
args.add("--avcodec-skiploopfilter")
args.add("1")
args.add("--avcodec-skip-frame")
args.add("0")
args.add("--avcodec-skip-idct")
args.add("0")
args.add("--subsdec-encoding");
args.add("")
args.add("--stats")
args.add("--android-display-chroma")
args.add("RV32")
args.add("--audio-resampler")
args.add("soxr")
var audiotrackSessionId = 0
val audioManager = this.getSystemService<AudioManager>()!!
audiotrackSessionId = audioManager.generateAudioSessionId()
args.add("--audiotrack-session-id=$audiotrackSessionId")
args.add("--freetype-rel-fontsize=16")
args.add("--freetype-color=16777215")
args.add("--freetype-background-opacity=0")
args.add("--no-sout-chromecast-audio-passthrough")
args.add("--sout-chromecast-conversion-quality=2")
args.add("--sout-keep")
args.add("--smb-force-v1")
args.add("--keystore")
args.add("file_crypt,none")
args.add("--keystore-file")
args.add(File(this.getDir("keystore", MODE_PRIVATE), "file").absolutePath)
val hstfDir = this.getDir("vlc", Context.MODE_PRIVATE)
val hstfPath = "${hstfDir.absolutePath}/.share/hrtfs/dodeca_and_7channel_3DSL_HRTF.sofa"
args.add("--spatialaudio-headphones")
args.add("--hrtf-file")
args.add(hstfPath)
args.add("--preferred-resolution=-1")
args.add("--aout=android_audiotrack ")
args.add("-vvv");
args.add("--freetype-color=16777215")
args.add("--freetype-rel-fontsize=16")
mLibVLC = LibVLC(this, args);
mMediaPlayer = MediaPlayer(mLibVLC)
videoLayout = findViewById(R.id.view_vlc_layout)
displayManager = DisplayManager(this, null, false, false, false)
}
override fun onStart() {
super.onStart()
if(!displayManager.isOnRenderer) videoLayout?.let {
mMediaPlayer?.attachViews(videoLayout!!, null, true, false);
val size = MediaPlayer.ScaleType.values()[MediaPlayer.ScaleType.SURFACE_BEST_FIT.ordinal]
mMediaPlayer?.videoScale = size
}
var uri: Uri = Uri.parse("url to hdr video")
var media: Media = Media(mLibVLC, uri)
mMediaPlayer?.media = media
media.release()
mMediaPlayer?.play()
mMediaPlayer?.setEventListener( MediaPlayer.EventListener { event: MediaPlayer.Event? -> if (event?.type == MediaPlayer.Event.Playing) {
mMediaPlayer?.getSpuTracks()
mMediaPlayer?.setSpuTrack(1)
}
})
}
}