Closed bolotkalil closed 6 years ago
Hi @bolotkalil,
I presume you've followed https://knowledge.kaltura.com/using-multi-audio-track-playback?
If possible, it would be best to provide a URL where the Kaltura player is embedded so we can take a look. In the event you cannot provide that, are you using Kaltura's SaaS or hosting the Kaltura Community Edition on your own servers? If SaaS, please open a support ticket, if you're using Kaltura CE, please provide a URL from which the source video can be downloaded. Please also provide the player version being used.
@jessp01 , thank you for your answer.
Yes, I have followed instruction: https://knowledge.kaltura.com/using-multi-audio-track-playback.
Below steps what I did:
Step 0. I have installed kaltura CE version 12.14.0-2 on the local machine.
Step 1. I have created two flavors for languages(kir, eng) with such params:
<xml>
<result>
<objectType>KalturaFlavorParams</objectType>
<relatedObjects>
</relatedObjects>
<id>47</id>
<partnerId>103</partnerId>
<name>Audio - Kirghiz</name>
<systemName>Audio - Kirghiz</systemName>
<description>Audio - Kirghiz</description>
<createdAt>1518934016</createdAt>
<isSystemDefault>0</isSystemDefault>
<tags>language,kir</tags>
<requiredPermissions>
</requiredPermissions>
<sourceRemoteStorageProfileId>0</sourceRemoteStorageProfileId>
<remoteStorageProfileIds>
</remoteStorageProfileIds>
<mediaParserType>0</mediaParserType>
<sourceAssetParamsIds>
</sourceAssetParamsIds>
<videoCodec>
</videoCodec>
<videoBitrate>0</videoBitrate>
<audioCodec>aac</audioCodec>
<audioBitrate>64</audioBitrate>
<audioChannels>2</audioChannels>
<audioSampleRate>44100</audioSampleRate>
<width>0</width>
<height>0</height>
<frameRate>0</frameRate>
<gopSize>0</gopSize>
<conversionEngines>2,99,3</conversionEngines>
<conversionEnginesExtraParams>
</conversionEnginesExtraParams>
<twoPass>0</twoPass>
<deinterlice>0</deinterlice>
<rotate>0</rotate>
<operators>
</operators>
<engineVersion>0</engineVersion>
<format>mp4</format>
<aspectRatioProcessingMode>0</aspectRatioProcessingMode>
<forceFrameToMultiplication16>1</forceFrameToMultiplication16>
<isGopInSec>0</isGopInSec>
<isAvoidVideoShrinkFramesizeToSource>0</isAvoidVideoShrinkFramesizeToSource>
<isAvoidVideoShrinkBitrateToSource>0</isAvoidVideoShrinkBitrateToSource>
<isVideoFrameRateForLowBrAppleHls>0</isVideoFrameRateForLowBrAppleHls>
<multiStream>
</multiStream>
<anamorphicPixels>0</anamorphicPixels>
<isAvoidForcedKeyFrames>0</isAvoidForcedKeyFrames>
<forcedKeyFramesMode>1</forcedKeyFramesMode>
<isCropIMX>1</isCropIMX>
<optimizationPolicy>1</optimizationPolicy>
<maxFrameRate>0</maxFrameRate>
<videoConstantBitrate>0</videoConstantBitrate>
<videoBitrateTolerance>0</videoBitrateTolerance>
<watermarkData>
</watermarkData>
<subtitlesData>
</subtitlesData>
<isEncrypted>0</isEncrypted>
<contentAwareness>0.5</contentAwareness>
<clipOffset>
</clipOffset>
<clipDuration>
</clipDuration>
</result>
<executionTime>0.03495192527771</executionTime>
</xml>
Step 2. I have created video file with multiple tracks:
http://nimb.ws/MkwvG1
Step 3. I have uploaded video file via kmc form, after converting I see the flavors(kir, eng) ingested audio from only first stream(kir).
Step 4. I have created xml file and upload it via bulk method I got same result:
<mrss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ingestion.xsd">
<channel>
<item>
<action>add</action>
<type>1</type>
<userId>103</userId>
<name>Test</name>
<description>Test video</description>
<media>
<mediaType>1</mediaType>
</media>
<contentAssets>
<content>
<assetContentResource assetId="0_io3sue20"></assetContentResource>
<streams>
<stream type="audio" trackIndex="1" language="kir" label="Kirghiz"></stream>
<stream type="audio" trackIndex="2" language="eng" label="English"></stream>
</streams>
</content>
</contentAssets>
</item>
</channel>
</mrss>
Maybe, did I do something wrong?
Many thanks for your help.
Hi @bolotkalil,
Please provide the source files you used to create output.m4 [input.mp4, 1.mp3 and 2.mp3] so I can use ffmpeg to merge them and test the ingestion and conversion locally on my ENV.
Hello, @jessp01 .
Here link to source files:
https://drive.google.com/file/d/1QUyzKNyznnaDEi1U9xIlyWDs-SvkbIm_/view?usp=sharing
Hi @bolotkalil.
Here is what you should do: To create the MP4 with the video and both tracks:
$ /opt/kaltura/bin/ffmpeg -y -i input.mp4 -i 1.mp3 -i 2.mp3 -map 0:v -map 1:a -map 2:a -metadata:s:a:0 language=kir -metadata:s:a:0 title="Kirghiz" -metadata:s:a:1 language=eng -metadata:s:a:1 title="English" -acodec copy -vcodec copy -movflags faststart output.mp4
Using your original ffmpeg command the following was emitted:
Codec 'mp3' (86017) is not supported by the bitstream filter 'aac_adtstoasc'. Supported codecs are: aac (86018) Error initializing bitstream filter: aac_adtstoasc
Next, you need to create the needed flavour IDs, one for English and one for Kirghiz. Place the below code on your server:
<?php
if (count($argv)<4){
echo __FILE__ . ' <partner id> <admin_secret> <service_url> '."\n";
exit (1);
}
require_once('/opt/kaltura/web/content/clientlibs/php5/KalturaClient.php');
require_once(__DIR__.'/create_session.php');
$userId = null;
$expiry = null;
$privileges = null;
$type = KalturaSessionType::ADMIN;
$partnerId=$argv[1];
$secret = $argv[2];
$service_url= $argv[3];
$client=generate_ks($service_url,$partnerId,$secret,$type,null,null,null);
$flavor_name='Audio ENG';
$filter = new KalturaFlavorParamsFilter();
$filter->systemNameEqual = $flavor_name;
$filter->formatEqual = KalturaContainerFormat::MP4;
$results = $client->flavorParams->listAction($filter, null);
if(!count($results->objects)){
$flavorParams = new KalturaFlavorParams();
$flavorParams->name = $flavor_name ;
$flavorParams->systemName = $flavor_name;
$flavorParams->description = $flavor_name;
$flavorParams->tags = 'mobile,web,mbr,iphone,audio_only,alt_audio';
$flavorParams->videoCodec = null;
$flavorParams->videoBitrate = 0;
$flavorParams->audioCodec = KalturaAudioCodec::AAC;
$flavorParams->audioBitrate = 64;
$flavorParams->audioChannels = 2;
$flavorParams->audioSampleRate = 44100;
$flavorParams->width = 0;
$flavorParams->height = 0;
$flavorParams->isSystemDefault = false;
$flavorParams->conversionEngines = '2,99';
$flavorParams->multiStream='{"audio":{"languages":["eng"]}}';
$flavorParams->format = KalturaContainerFormat::MP4;
$results = $client->flavorParams->add($flavorParams);
$eng_id=$results->id;
}else{
$eng_id=$results->objects[0]->id;
echo ("$flavor_name with ID $eng_id already exists. Skipping.");
}
echo("$flavor_name flavor Param ID is $eng_id\n");
$flavor_name='Audio KIR';
$filter = new KalturaFlavorParamsFilter();
$filter->systemNameEqual = $flavor_name;
$filter->formatEqual = KalturaContainerFormat::MP4;
$results = $client->flavorParams->listAction($filter, null);
if(!count($results->objects)){
$flavorParams = new KalturaFlavorParams();
$flavorParams->name = $flavor_name ;
$flavorParams->systemName = $flavor_name;
$flavorParams->description = $flavor_name;
$flavorParams->tags = 'mobile,web,mbr,iphone,audio_only,alt_audio';
$flavorParams->videoCodec = null;
$flavorParams->videoBitrate = 0;
$flavorParams->audioCodec = KalturaAudioCodec::AAC;
$flavorParams->audioBitrate = 64;
$flavorParams->audioChannels = 2;
$flavorParams->audioSampleRate = 44100;
$flavorParams->width = 0;
$flavorParams->height = 0;
$flavorParams->isSystemDefault = false;
$flavorParams->conversionEngines = '2,99';
$flavorParams->format = KalturaContainerFormat::MP4;
$flavorParams->multiStream='{"audio":{"languages":["ky","kir"]}}';
$results = $client->flavorParams->add($flavorParams);
$kir_id=$results->id;
}else{
$kir_id=$results->objects[0]->id;
echo ("$flavor_name with ID $kir_id already exists. Skipping.");
}
echo("$flavor_name Param ID is $kir_id\n");
?>
And call it like this:
# php /opt/kaltura/bin/create_flavor_params.php <partner id> <admin_secret> <service_url>
Then, you'll need to add these new flavour params to your transcoding profile. Log in to KMC->Settings->Transcoding Settings and check "Audio ENG" and "Audio KIR".
Then upload your file. Should be fine.
Hello, @jessp01 .
Thank you so much for your help and for your time. It works on the version 13.13.0, but doesn't work on version 12.14.0-2.
Thank you again!
hi @jessp01
your kindly shared code cannot be executed as it depends on require_once(__DIR__.'/create_session.php');
not included. would you please pass it?
UPDATE: Will answer myself, one can find it here raw file link
Hi @richhl,
The original poster @bolotkalil, uses Kaltura CE, where create_session.php and the Kaltura PHP client are available. However, the same exact code can work against Kaltura's SaaS ENV as well.
You may obtain create_session.php
from here:
https://github.com/kaltura/platform-install-packages/blob/Naos-14.0.0/RPM/scripts/postinst/create_session.php
Place it in the same directory as where you placed the code I attached above. You will also need the Kaltura PHP client which you can obtain from https://github.com/kaltura/KalturaGeneratedAPIClientsPHP/archive/14.0.0.zip
Make sure the path to https://github.com/kaltura/platform-install-packages/blob/Naos-14.0.0/RPM/scripts/postinst/create_session.php#L2 is adjusted so that it points to where you placed the client.
Should you have additional questions, feel free to post them here.
Hi @richhl,
Actually, I still see the $low_id
in your above code:)
In the sample code, which I wrote to answer @bolotkalil's specific question, the vars should be $eng_id
and $kir_id
since these are the langs audio tracks were required for.
Please see the revisions I made to the original reply. That said, this is only meant as an example, naturally, it should be modified to suit your specific needs.
Since this was meant for illustration purposes, I also tried to make is a simple and straightforward as possible. If you intend to use it repeatedly, it would be advisable to create a function called add_audio_flavour()
which will accept the desired name [ideally a string that includes the language], description [although really "Audio $lang" feels descriptive enough:)] and the language code [which you can then use to set flavorParams->multiStream
] as arguments.
thx @jessp01 I have followed all steps, and ingestion with audio flavors goes well but the standalone page is not able to load the video. any hints?
Below the kmc's flavors tab for that entry
Hi @richhl,
The embed you provided works well for me. I'm able to play the video and toggle between the audio tracks.
Please also open your browser's dev tools and check for errors in the "Console" tab as well as for failing requests under the "Network" tab.
Also, note that this content belongs to the original poster so you shouldn't use it without his consent.
well, such a strange thing. here you are my browser output. I have uploaded the files provided by @bolotkalil for the unique purpose of testing the process that you have highlighted. Will delete it as soon as tested. is it ok @bolotkalil ?
Hi @richhl,
All I see here are analytics requests which shouldn't affect playback and, at any rate, returned correctly with HTTP 200. Please check for failing requests and post them here should you see any [plain text would be easier than an image] and also check the "Consola" tab for errors.
in fact, bottom window in that picture is Consola. There are no failing request logged. Anyway I will stop asking until I produce my own material. Thx. @jessp01 It's better to open a new issue thread for asking in the future or should I use this one?
Hi @richhl,
Seeing how the example you provided works for me, I think your original goal is achieved:) If you have additional questions pertaining to multiple audio tracks, you can continue to post them here. However, if you have other, unrelated questions, it would be best to open a separate issue.
Hello, Guys.
I have created single video file with multiple audio using this ffmpeg code:
ffmpeg -y -i input.mp4 -i 1.mp3 -i 2.mp3 -map 0:v -map 1:a -map 2:a -metadata:s:a:0 language=kir -metadata:s:a:0 title="Kirghiz" -metadata:s:a:1 language=eng -metadata:s:a:1 title="English" -acodec copy -bsf:a aac_adtstoasc -vcodec copy -movflags faststart output.mp4
But on the kaltura after uploading the video file, audio selector on the player is inactive, why?
I have tried also with xml file, the result is same.
Please help me I couldn't find the reason why this happens.
Many thanks.