我收到错误 "deprecated pixel format used, make sure you did set range correctly using ffmpeg".. 有人可以检查我下面的代码吗?

Im getting error "deprecated pixel format used, make sure you did set range correctly using ffmpeg".. can someone check my code below?

这是我的代码,使用 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 论坛,从命令行调用时可以忽略它,我总是忽略它。您可以尝试的一件事(请使用虚拟文件进行测试)是将 -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

Afaict, the warning is primarily meant for library users, ffmpeg users should not be affected.

好的,到时候就无视了。

我只是更改了图片的目标路径:

# path of image on the server
$image = '/users/xx/xxxx/sample/upload/image.jpg'; 

然后使用了以下内容:

# $ffmpeg - path of ffmpeg on the server
# $video_url - path of the video file on the server

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");