gpt4 book ai didi

php ffmpeg flv 转换错误

转载 作者:行者123 更新时间:2023-12-04 23:31:07 24 4
gpt4 key购买 nike

我正在尝试将 mp4 文件转换为 flv,但我得到 0 大小的 flv 文件,

你能帮我解决这个问题吗

array(45) { [0]=string(72) "FFmpeg version SVN-r26402, Copyright (c)2000-2011 the FFmpeg developers" [1]=string(74) " built on Jan 122012 16:07:49 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)" [2]=>string(98) " configuration: --enable-libmp3lame --enable-gpl--enable-libvorbis --disable-mmx --enable-shared" [3]=string(35) " libavutil 50.36. 0 / 50.36. 0" [4]=string(35) " libavcore 0.16. 1 /0.16. 1" [5]=string(37) " libavcodec 52.108. 0 / 52.108. 0" [6]=string(35) " libavformat 52.93. 0 / 52.93. 0" [7]=string(35) "libavdevice 52. 2. 3 / 52. 2. 3" [8]=string(35) " libavfilter 1.74.0 / 1.74. 0" [9]=string(35) " libswscale 0.12. 0 / 0.12. 0" [10]=>string(0) "" [11]=string(101) "Seems stream 0 codec frame ratediffers from container frame rate: 30000.00 (30000/1) -15.00 (15/1)"[12]=string(106) "Input #0, mov,mp4,m4a,3gp,3g2,mj2, from'16112007069.mp4':"[13]=string(11) " Metadata:" [14]=string(26) " major_brand : mp42"[15]=string(23) " minor_version : 0" [16]=string(35) "compatible_brands: mp423gp4isom" [17]=string(41) " creation_time :2007-11-16 15:44:57" [18]=string(59) " Duration: 00:00:32.64, start:0.000000, bitrate: 562 kb/s" [19]=string(115) " Stream #0.0(und): Video: mpeg4, yuv420p, 352x288 [PAR 1:1 DAR 11:9], 512 kb/s, 15 fps,15 tbr, 30k tbn, 30k tbc" [20]=string(13) " Metadata:" [21]=>string(43) " creation_time : 2007-11-16 15:44:57" [22]=string(62) "Stream #0.1(und): Audio: aac, 16000 Hz, mono, s16, 48 kb/s" [23]=>string(13) " Metadata:" [24]=string(43) " creation_time : 2007-11-1615:44:58" [25]=string(87) "WARNING: The bitrate parameter is set toolow. It takes bits/s as argument, not kbits/s" [26]=string(47)"[buffer @ 0x94a9de0] w:352 h:288 pixfmt:yuv420p" [27]=string(98)"[libmp3lame @ 0x94a9560] flv does not support that sample rate,choose from (44100, 22050, 11025)." [28]=string(85) "Output #0, flv,to '16112007069.flv':" [29]=string(11) " Metadata:" [30]=string(26) " major_brand : mp42"[31]=string(23) " minor_version : 0" [32]=string(35) "compatible_brands: mp423gp4isom" [33]=string(41) " creation_time :2007-11-16 15:44:57" [34]=string(33) " encoder : Lavf52.93.0" [35]=>string(103) " Stream #0.0(und): Video: flv, yuv420p, 352x288 [PAR 1:1DAR 11:9], q=2-31, 200 kb/s, 1k tbn, 15 tbc" [36]=string(13) "Metadata:" [37]=string(43) " creation_time : 2007-11-16 15:44:57"[38]=string(68) " Stream #0.1(und): Audio: libmp3lame, 16000 Hz,mono, s16, 0 kb/s" [39]=string(13) " Metadata:" [40]=string(43) "creation_time : 2007-11-16 15:44:58" [41]=string(15) "Streammapping:" [42]=string(21) " Stream #0.0 -#0.0" [43]=string(21) "Stream #0.1 -#0.1" [44]=string(72) "Could not write header foroutput file #0 (incorrect codec parameters ?)" }  ffmpeg: /usr/local/bin/ffmpeg filepath: 16112007069.mp4srcAR: 16000srcAB:48dimention: 352 x 288 destFile: 16112007069.flv

coding part: :)

$srcFile = "/file destination/16112007069.mp4";  
$destFile = "/file destination/16112007069.flv";
$ffmpegPath = "/usr/local/bin/ffmpeg";

$ffmpegObj = new ffmpeg_movie($srcFile);

$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate());
$srcAR => $ffmpegObj->getAudioSampleRate();

exec($ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " 2>&1", $output);

var_dump($output);

print "<br />ffmpeg: $ffmpegPath<br />"; print "file path: $srcFile<br
/>"; print "srcAR: $srcAR<br />"; print "srcAB: $srcAB<br />"; print
"dimention: $srcWidth x $srcHeight<br />"; print "destFile:
$destFile<br />";


function makeMultipleTwo ($value) {
$sType = gettype($value/2);
if($sType == "integer")
{
return $value;
} else {
return ($value-1);
}
}

备注 我补充说:
if($srcAR<41000){ $srcAR = "41000"; }

以上及其工作!

最佳答案

测试这个:

ffmpeg -i src.avi -an dest.flv

关于php ffmpeg flv 转换错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8850634/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com