本文介绍了出现错误“使用了不赞成使用的像素格式,请确保您已使用ffmpeg正确设置了范围"..有人可以在下面检查我的代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我使用ffmpeg编写的代码,我想拥有视频缩略图,但是我对ffmpeg不熟悉,有人可以知道我遇到的错误.

[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%

这也是我的代码:

$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");  
解决方案

根据ffmpeg论坛,在命令行中调用时可以忽略它,而我始终忽略它.您可以尝试的一件事(请使用虚拟文件PLEASE进行测试)是将-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

好的,那么请忽略它.

This is my code using ffmpeg i want to have video thumbnail but im 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 guaratee 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

OK, will just ignore it then.

这篇关于出现错误“使用了不赞成使用的像素格式,请确保您已使用ffmpeg正确设置了范围"..有人可以在下面检查我的代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 22:09