![](/img/trans.png)
[英]How to convert mp4 files into mp3 on button click using ffmpeg/php?
[英]PHP FFmpeg conversion issues for mp4 files
我想通過使用ffmpeg-php
從mp4
文件中獲取圖像。
我有
$str_command= '/usr/bin/ffmpeg -i /test/ts.mp4 -r 1 -ss 00:00:10 -t 00:00:01 -s 300x300 -f image2 /test/images/';
shell_exec($str_command);
但是,我收到一條錯誤消息
Buffering several frames is not supported. Please consume all available frames before adding a new one.
我在網上花了幾個小時但卻找不到答案。 任何人都可以幫我這個嗎? 非常感謝!
你有沒有檢查過PHP的ffmpeg庫? 我之前使用它,它抽象出所有復雜的命令行調用,就像你試圖運行的那樣。 您可以使用$ movie-> getFrame($ n)來獲取幀對象,使用$ frame-> toGDImage()將其輸出為圖像。
例如,
$movie = new ffmpeg('/path/to/movie.mp4');
$frame10 = $movie->getFrame(10);
$image = $frame10->toGDImage();
// Now display the image
header('Content-Type: image/jpeg');
imagejpeg($image);
// Or save it to a file
$saved = imagejpeg($image, '/path/to/new/file.jpg');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.