gpt4 book ai didi

php - 使用 ming 从 png 图像创建 flv 视频

转载 作者:搜寻专家 更新时间:2023-10-31 22:14:19 26 4
gpt4 key购买 nike

我正在尝试从多个 png 生成 flv 视频,但输出视频似乎已损坏,没有播放器可以播放它。

<?php
$video = new SWFMovie();
$video->setDimension(640, 360);

$img = new SWFShape();
$png = fopen("/home/damiano/a.dbl", "rb");
$img->addFill(new SWFBitmap($png));
fclose($png);

$video->add($img);

header('Content-type: application/x-shockwave-flash');
$video->output();
?>

浏览器不显示任何内容(甚至几毫秒也不显示),vlc 播放器和其他播放器也不显示。要抓取视频到文件,我使用:

curl 'http://localhost/ming.php' > vid.flv

导入 png 有什么问题?为什么我看不了视频?我错过了什么?

最佳答案

我用过这个代码。

       //Muse addition below   - creates flv and thumbnail of file and uploads it           
$target_file_name = replaceexts($new_file_name,"flv");
$flvtarget ="$imagedir".$target_file_name;
//echo substr(sprintf('%o', fileperms('../3/uploades/video')), -4);
// @chmod($configfile, 0777);
// //echo "../3/uploades/video/".$new_file_name;
//$permission = is_writeable($configfile);
move_uploaded_file($_FILES['myfile']['tmp_name'], "../3/uploades/video/".$new_file_name);
// @chmod($configfile, 0777);
$imgtarget ="$imagedir".replaceexts($new_file_name,"jpg");
//video
//Original:
// $cmd = "/usr/bin/ffmpeg -v 0 -i $upload_path -acodec pcm_s16le -s 320x240 -b 512k -ab 128k -ar 44100 -bt 40000k $flvtarget";
//Options Meaning:
// Input file options
// -v 0 -- Logging verbosity level -- I guess 0 means - "Silent"

// Output file options:
// -acodec pcm_s16le: force audio codec to the selected (pcm_s16le) -- WHy?
// -s 320x320 -- frame size
// -b 512k -- video bit rate
// -ab 128k -- audio bitrate

//Added:

// -ar 44100 -- set the audio sampling frequency. Default is 44100. So shouldn't be necessary to add this option, but apparently is necessary, to force it.


//exec($cmd);

//video
// $cmd = "/usr/bin/ffmpeg -v 0 -i $upload_path -acodec pcm_s16le -s 320x240 -b 512k -ab 128k $flvtarget";
// $cmd = "/usr/bin/ffmpeg -v 0 -i $upload_path -acodec pcm_s16le -s vga -b 512k -ab 128k -aspect 4:3 -target flv $flvtarget";



$cmd = "/usr/bin/ffmpeg -i $upload_path -s 320x240 -b 512k -ab 128k -acodec libmp3lame -ar 22050 -f flv $flvtarget";
exec($cmd);
//thumb
$cmd = "/usr/bin/ffmpeg -i $upload_path -deinterlace -an -ss 2 -t 00:00:01 -r 1 -y -s 80x60 -vcodec mjpeg -f mjpeg $imgtarget 2>&1";
exec($cmd);

关于php - 使用 ming 从 png 图像创建 flv 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8503110/

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