View Full Version : Possible to bind subtitle and audio?
Devilman1
29th July 2006, 15:40
I have a dual audio avi, and forced sub for both audio, I would like to make so that when I choose an audio stream the correct forced sub is loaded.
Is it possible with matroska? and how?
Is it possible with other container?
TIA
unmei
30th July 2006, 00:31
I don't think there is a container that lets the file author state what subtitle stream goes with which audio stream. Matroska lets you define a subtitle stream (but that then gets by defualt loaded no matter what audio stream is played). AVI does specify nothing and for mp4 i also think there is at most a simple default flag.
However this issues is for example at least partially solved in Haali's splitter (any maybe other splitters or built-in in players) *at the playback stage*. That is, this splitter lets you set somewhere in it's options your preferred combinations. It the selects the first combination of streams in your preferred list that is possible in the file you are about to play. For example, if you set your preferences to (most preferred at top, actual synthax is probably different, but there is an example in the splitter):
audio=french, subs=english
audio=german, subs=english
audio=english
consider file1: contains french audio and english subs
->plays french with english subs
consider file2: contains french and english audio, no subs
->plays english audio and no subs
foxyshadis
30th July 2006, 01:06
The option is "audio and subtitle languages", for example mine is:
fre,eng;fre,fre;ger,eng;jpn,eng;deu,eng;eng,off;*,eng;*,fre
They're listed in order of preference.
There's also an option "match subtitle track to audio", but that shows the same language as the audio, and I'm not sure if that's what you were aiming for.
Haali
31st July 2006, 12:39
This is possible with trackset tags in my splitter, more info is on my news page.
Drachir
1st August 2006, 10:01
In MP4 this is possible with BIFS. But for playback you will need a MP4 player with BIFS support.
You could do it this way:
#IOD START
InitialObjectDescriptor {
audioProfileLevelIndication 255
visualProfileLevelIndication 254
sceneProfileLevelIndication 254
graphicsProfileLevelIndication 254
ODProfileLevelIndication 255
esDescr [
ES_Descriptor {
ES_ID 1
decConfigDescr DecoderConfigDescriptor {
objectTypeIndication 2
streamType 3
decSpecificInfo BIFSConfig {
isCommandStream true
pixelMetric true
pixelWidth 688 #define scene width
pixelHeight 320 #define scene height
}
}
}
ES_Descriptor {
ES_ID 2
OCR_ES_ID 1
decConfigDescr DecoderConfigDescriptor {
objectTypeIndication 1
streamType 1
}
}
]
}#IOD END
#SCENE START (BIFS Track)
OrderedGroup {
children [
Background2D {
backColor 0 0 0
}
DEF SW1 Switch {
whichChoice 0
choice [
OrderedGroup {}
OrderedGroup {
children [
Sound2D {
source DEF Audio AudioSource {
url [od:20]
startTime -1
}
}
Shape {
appearance Appearance {
texture DEF Video MovieTexture {
url [od:10]
startTime -1
}
}
geometry Bitmap {}
}
DEF Subtitle AnimationStream {
url [ "od:40" ]
startTime -1
}
DEF MovieControl MediaControl {
url [ "od:10" ]
mediaSpeed 0.0
}
DEF TS3 TouchSensor {}
]
}
]
}
DEF SW2 Switch {
whichChoice 0
choice [
OrderedGroup {
children [
Transform2D {
children [
Shape {
appearance Appearance {
material Material2D {
emissiveColor 0 0 0
filled TRUE
}
}
geometry Rectangle {
size 195 135
}
}
]
}
Transform2D {
translation 0 30
children [
Shape {
appearance Appearance {
material Material2D {
emissiveColor 1 1 1
filled TRUE
}
}
geometry Rectangle {
size 170 55
}
}
]
}
Transform2D {
translation 0 -30
children [
Shape {
appearance Appearance {
material Material2D {
emissiveColor 1 1 1
filled TRUE
}
}
geometry Rectangle {
size 170 55
}
}
]
}
Transform2D {
translation 0 30
children [
Shape {
appearance Appearance {
material Material2D {
emissiveColor 0 0 0
filled TRUE
}
}
geometry Rectangle {
size 167 52
}
}
Transform2D {
translation 0 -10
children [
Shape {
appearance Appearance {
material Material2D {
emissiveColor 1 1 1
filled TRUE
}
}
geometry Text {
string ["GERMAN"]
fontStyle FontStyle {
justify ["MIDDLE"]
size 20
}
}
}
]
}
DEF TS1 TouchSensor {}
]
}
Transform2D {
translation 0 -30
children [
Shape {
appearance Appearance {
material Material2D {
emissiveColor 0 0 0
filled TRUE
}
}
geometry Rectangle {
size 167 52
}
}
Transform2D {
translation 0 -10
children [
Shape {
appearance Appearance {
material Material2D {
emissiveColor 1 1 1
filled TRUE
}
}
geometry Text {
string ["ENGLISH"]
fontStyle FontStyle {
justify ["MIDDLE"]
size 20
}
}
}
]
}
DEF TS2 TouchSensor {}
]
}
]
}
OrderedGroup {}
]
}
DEF PlayAudio1 Conditional {
buffer {
REPLACE SW1.whichChoice BY 1
REPLACE SW2.whichChoice BY 1
REPLACE Audio.url BY [od:20]
REPLACE Subtitle.url BY [od:40]
REPLACE MovieControl.mediaSpeed BY 1.0
REPLACE Audio.startTime BY 0
REPLACE Video.startTime BY 0
REPLACE Subtitle.startTime BY 0
}
}
DEF PlayAudio2 Conditional {
buffer {
REPLACE SW1.whichChoice BY 1
REPLACE SW2.whichChoice BY 1
REPLACE Audio.url BY [od:30]
REPLACE Subtitle.url BY [od:50]
REPLACE MovieControl.mediaSpeed BY 1.0
REPLACE Audio.startTime BY 0
REPLACE Video.startTime BY 0
REPLACE Subtitle.startTime BY 0
}
}
DEF ShowAudioMenue Conditional {
buffer {
REPLACE SW2.whichChoice BY 0
}
}
]
}
ROUTE TS1.isActive TO PlayAudio1.activate
ROUTE TS2.isActive TO PlayAudio2.activate
ROUTE TS3.isActive TO ShowAudioMenue.activate
#SCENE END
#OD Track START
AT 0 {
UPDATE OD [
ObjectDescriptor {
objectDescriptorID 10
esDescr [
ES_Descriptor {
ES_ID 3
OCR_ES_ID 1
muxInfo MuxInfo {
fileName "video.cmp" #set the path/name of the input file
frameRate "25.000" #adjust frame rate
}
}
]
}
ObjectDescriptor {
objectDescriptorID 20
esDescr [
ES_Descriptor {
ES_ID 4
OCR_ES_ID 1
muxInfo MuxInfo {
fileName "german.aac" #set the path/name of the input file
}
langDescr LanguageDescriptor {
languageCode "ger" #set languge in ISO 639-2
}
}
]
}
ObjectDescriptor {
objectDescriptorID 30
esDescr [
ES_Descriptor {
ES_ID 5
OCR_ES_ID 1
muxInfo MuxInfo {
fileName "english.aac" #set the path/name of the input file
}
langDescr LanguageDescriptor {
languageCode "eng" #set languge in ISO 639-2
}
}
]
}
ObjectDescriptor {
objectDescriptorID 40
esDescr [
ES_Descriptor {
ES_ID 6
OCR_ES_ID 1
muxInfo MuxInfo {
fileName "forcedGer.ttxt" #set the path/name of the input file
}
langDescr LanguageDescriptor {
languageCode "ger" #set languge in ISO 639-2
}
}
]
}
ObjectDescriptor {
objectDescriptorID 50
esDescr [
ES_Descriptor {
ES_ID 7
OCR_ES_ID 1
muxInfo MuxInfo {
fileName "forcedEng.ttxt" #set the path/name of the input file
}
langDescr LanguageDescriptor {
languageCode "eng" #set languge in ISO 639-2
}
}
]
}
]
}#OD Track END
Adjust the BIFStext file and create a MP4 file with it:
MP4Box -mp4 BIFStext.bt
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.