Closed screamjojo closed 6 months ago
Not an option using the base configuration, would need to be a custom function
Feel free to post your custom function that's not working and I'll take a look. canBypassConvert
is probably the one you want
If I had DTS in autoprocess.ini I've trying this custom "blockaudiocopy" :
def blockAudioCopy(mp, stream, path, info):
# Custom function that skips HDR files that are missing proper HDR metadata / framedata
mp.log.info("Initiating custom audio copy check method.")
fra_audio_streams = [a for a in info.audio if a.metadata.get('language', '') == 'fra' and (a.metadata.get('codec', '') != 'ac3' or a.metadata.get('codec', '') != 'aac' or a.metadata.get('codec', '') != 'eac3')]
if stream in fra_audio_streams:
mp.log.info("found a fra language with not ac3 or aac or eac3 codec, conversion needed")
return True
return False
I was more looking for your canBypassConvert attempt since that's what you're trying to do now, no?
Sorry, I misremembered the name of the custom function, you would want to intervene on the validation
function, not canBypassConvert
as this is an internal function you shouldn't be modifying unless you're looking to fork the code
def validation(mp, info, path, tagdata):
# Custom function that skips files that don't have french audio
mp.log.info("Initiating custom validation method.")
fra_audio_streams = [a for a in info.audio if a.metadata.get('language', '') == 'fra']
return len(fra_audio_streams) > 0
Sorry, I misremembered the name of the custom function, you would want to intervene on the
validation
function, notcanBypassConvert
as this is an internal function you shouldn't be modifying unless you're looking to fork the codedef validation(mp, info, path, tagdata): # Custom function that skips files that don't have french audio mp.log.info("Initiating custom validation method.") fra_audio_streams = [a for a in info.audio if a.metadata.get('language', '') == 'fra'] return len(fra_audio_streams) > 0
Thank you but it's not what I want. I would like to don't convert the others audio tracks if not fra, but the file may be converted ...
Got it, that wasn't clear at all
Might be able to do this by getting creative about manipulating the codec settings on the fly for each stream
If you want to always remux nonfrench streams you could force the codec pool to be 'copy' in those instances and then apply a more standard codec pool for the french streams
def blockAudioCopy(mp, stream, path):
# Custom function that modifies codec pool depending on language
mp.log.info("Initiating custom audio copy check method.")
if stream.metadata.get('language') == 'fra':
mp.settings.acodec = ['ac3', 'eac3', 'aac'] # maintain default behavior
else:
mp.settings.acodec = ['copy'] # force copy
return False
Otherwise if that's still not the desired effect you need to be much more explicit about what you're trying to do
Of note, you're essentially bypassing your audio codec settings here and manually setting them, so in the future if you decide you change what codecs you want you'll need to update this function too
Got it, that wasn't clear at all
Might be able to do this by getting creative about manipulating the codec settings on the fly for each stream
If you want to always remux nonfrench streams you could force the codec pool to be 'copy' in those instances and then apply a more standard codec pool for the french streams
def blockAudioCopy(mp, stream, path): # Custom function that modifies codec pool depending on language mp.log.info("Initiating custom audio copy check method.") if stream.metadata.get('language') == 'fra': mp.settings.acodec = ['ac3', 'eac3', 'aac'] # maintain default behavior else: mp.settings.acodec = ['copy'] # force copy return False
Otherwise if that's still not the desired effect you need to be much more explicit about what you're trying to do
Of note, you're essentially bypassing your audio codec settings here and manually setting them, so in the future if you decide you change what codecs you want you'll need to update this function too
Worked like a charm ! Thank you so much :)
Hi,
Is there a way to only convert if a french audio track is not in codec list form the autoprocess.ini ? I don't want a conversion for the others language audio tracks.
IE :
I've try custom function and canBypassConvert without success.
Thank you for helping.