Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
856 views
in Technique[技术] by (71.8m points)

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

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");  
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...