这是我使用 ffmpeg
的代码我想要视频缩略图但我不熟悉 ffmpeg
谁能知道我遇到的错误.
[swscaler @ 0x7ff8da028c00] 不推荐使用的像素格式,请确保您没有正确设置范围输出#0,mjpeg,到'image.jpg':元数据:主要品牌:mp42次要版本:0兼容品牌:isomp42编码器:Lavf56.36.100流 #0:0(und): 视频: mjpeg, yuvj420p(pc), 320x240 [SAR 4:3 DAR 16:9], q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc (默认)元数据:创作时间:2016-11-06 09:40:22handler_name :由 Google Inc. 制作的 ISO 媒体文件.编码器:Lavc56.41.100 mjpeg流映射:流#0:0 ->#0:0(h264(本机)-> mjpeg(本机))按 [q] 停止,按 [?] 寻求帮助帧= 1 fps=0.0 q=4.8 Lsize= 16kB 时间=00:00:01.00 比特率= 129.5kbits/s视频:16kB 音频:0kB 字幕:0kB 其他流:0kB 全局标题:0kB 复用开销:0.000000%
这也是我的代码:
$video_url ='https://URL/upload/4b8acab123563649f19e07450d810df6.mp4';$ffmpeg = '/opt/local/bin/ffmpeg';$image = 'image.jpg';$间隔= 5;$size = '320x240';shell_exec($tmp = "$ffmpeg -i $video_url -deinterlace -an -ss $interval -f mjpeg -t 1 -r 1 -y -s $size $image 2>&1");
根据 ffmpeg 论坛,从命令行调用时可以忽略它,我总是忽略它.您可以尝试的一件事(请使用虚拟文件进行测试)是将 -pix_fmt yuvj422p
添加到最后一行,使其看起来像这样:
shell_exec($tmp = "$ffmpeg -i $video_url -pix_fmt yuvj422p -deinterlace -an -ss $interval -f mjpeg -t 1 -r 1 -y -s $size $image 2>&;1");
正如我所说,请测试它,因为我不能保证结果,但就我而言,我已经使用了 ffmpeg 数千次,即使有警告,一切看起来也很好.
https://lists.ffmpeg.org/pipermail/ffmpeg-user/2014-February/020151.html
<块引用><块引用>事实上,警告主要是针对图书馆用户的,ffmpeg 用户不应该受到影响.
好的,那就忽略它.
This is my code using ffmpeg
I want to have video thumbnail but I'm not familiar in ffmpeg
can someone know the error I got.
[swscaler @ 0x7ff8da028c00] deprecated pixel format used, make sure you did set range correctly
Output #0, mjpeg, to 'image.jpg':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf56.36.100
Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 320x240 [SAR 4:3 DAR 16:9], q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc (default)
Metadata:
creation_time : 2016-11-06 09:40:22
handler_name : ISO Media file produced by Google Inc.
encoder : Lavc56.41.100 mjpeg
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=4.8 Lsize= 16kB time=00:00:01.00 bitrate= 129.5kbits/s
video:16kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Also This is my code:
$video_url ='https://URL/upload/4b8acab123563649f19e07450d810df6.mp4';
$ffmpeg = '/opt/local/bin/ffmpeg';
$image = 'image.jpg';
$interval = 5;
$size = '320x240';
shell_exec($tmp = "$ffmpeg -i $video_url -deinterlace -an -ss $interval -f mjpeg -t 1 -r 1 -y -s $size $image 2>&1");
According to ffmpeg forum this can be ignored when called from the command line and I always ignored it. One thing you can try (test with a dummy file PLEASE) is to add -pix_fmt yuvj422p
to your last line so it look like this:
shell_exec($tmp = "$ffmpeg -i $video_url -pix_fmt yuvj422p -deinterlace -an -ss $interval -f mjpeg -t 1 -r 1 -y -s $size $image 2>&1");
As I said, test it please as I cannot guarantee the results but as far as I'm concerned I've used ffmpeg thousand of times and everything looks just fine even with the warning.
https://lists.ffmpeg.org/pipermail/ffmpeg-user/2014-February/020151.html
Afaict, the warning is primarily meant for library users, ffmpeg users should not be affected.
OK, will just ignore it then.
这篇关于我收到错误“使用了已弃用的像素格式,请确保您使用 ffmpeg 正确设置了范围"……有人可以检查我下面的代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!