Reputation: 21
I am using FFMPEG to encrypt my uploaded videos. I am using laravel. I've used a ffmpeg laravel package.
$highBitrate = (new X264)->setKiloBitrate(25);
//start encrypting fulllength files
FFMpeg::fromDisk('public')
->open($filePath) // Provide the path relative to the 'local' disk
->exportForHLS()
->withRotatingEncryptionKey(function ($filename, $contents) use ($folderName,$uniquen_number) {
Storage::disk('public')->put('uploads/Videos_to_Revise/'.$folderName.'/'.$uniquen_number . '/encrypted_files/' . $filename, $contents);
})
->addFormat($highBitrate)
->save('uploads/Videos_to_Revise/'.$folderName.'/'.$uniquen_number . '/encrypted_files/'.$uniquen_number.'.m3u8');
//end encrypting fulllength files
//start encrypting cropped files
FFMpeg::fromDisk('public')
->open('uploads/Videos_to_Revise/'.$folderName.'/'.$uniquen_number.'/'.$newFileName_cropped_file) // Provide the path relative to the 'local' disk
->exportForHLS()
->withRotatingEncryptionKey(function ($filename, $contents) use ($folderName,$uniquen_number) {
Storage::disk('public')->put('uploads/Videos_to_Revise/'.$folderName.'/'.$uniquen_number . '/encrypted_files/' . $filename, $contents);
})
->addFormat($highBitrate)
->save('uploads/Videos_to_Revise/'.$folderName.'/'.$uniquen_number . '/encrypted_files/'.$uniquen_number.'_cropped.m3u8');
It is working fine. In the folder there are creating many keys and ts files. Means if I upload a file of 50 MB then it generates 100 keys files and around 100 ts files.
Can I restrict the number of keys and ts files by 1 or 2?
Upvotes: 0
Views: 42