Open Gemorroj opened 10 years ago
I added this hook for my code. This fixes my problem.
/**
* libmp3lame not supported sample_rate lower 16000
* firefox not play sample_rate lower 32000
*
* @param FFmpegAudio $media
* @return Video
*/
protected function addLibMp3LameFilter(FFmpegAudio $media)
{
$sampleRate = $media->getStreams()->audios()->first()->get('sample_rate');
if ($sampleRate < 32000) {
$media->addFilter(new AudioResamplableFilter(32000));
}
return $this;
}
Hi I'm having the same problem, where would I add this hook? and how would I invoke it?
thanks
@Gemorroj still actual?
@Gemorroj please mention where to add these codes and how to se it
@EmiiKhaos, @visakhsujathan, @sathio sorry for delay 🤓
this issue steel actual for v0.11.1 pl 1
release.
i use windows 10x64, ffmpeg 3.4.2 (https://ffmpeg.zeranoe.com/builds/)
tested 3gp file: small.3gp.zip
example:
<?php
use FFMpeg\Format\Video\X264;
use FFMpeg\Filters\Audio\AudioResamplableFilter;
use FFMpeg\FFMpeg;
$ffmpeg = FFMpeg::create();
$media = $ffmpeg->open('path_to_original_file.3gp');
$format = new X264('libmp3lame'); // but now i use aac, with aac, the bug is not reproduced
// add workaround
// libmp3lame not supported sample_rate lower 16000
// firefox not play sample_rate lower 32000
$sampleRate = $media->getStreams()->audios()->first()->get('sample_rate');
if ($sampleRate < 32000) {
$media->addFilter(new AudioResamplableFilter(32000));
}
// end workaround
$media->save($format, 'path_to_converted_file.mp4');
I don't see where the bug lies in? Do you basically want us to set a default resample filter of 32000?
@jens1o no, I don't know what the right behavior is. Previously, libmp3lame
was used and it did not convert the file. It is unclear why. You may need to call trigger_error or Exception, or add filter... That is, hint the user about the problem.
In any case, that would mean a breaking change :/
Hello. I create mp4 file from 3gp:
Result:
Any help? :sweat: