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

2

36

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");  
Cypress answered 27/3, 2017 at 5:3 Comment(6)
Please see #23068222Scutum
Possible duplicate of swscaler warning : deprecated pixel format usedScutum
@LouisLoudogTrottier sorry im not familiar in ffmpeg how can i apply the 1st link you give to me , where can i change that format?Cypress
You can ignore it. JPEGs are full range so the pix fmt is fine here.Hughhughes
Good explanation here: superuser.com/a/1273941/53547 on why this normal, and you should ignore that warning.Undervest
Looks like yuvj420p has been replaced by yuvj422pChum
S
34

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.

Scutum answered 27/3, 2017 at 5:22 Comment(7)
but i cant get any image file when i execute it.Cypress
where can i add this -pix_fmt yuvj422pCypress
i change the path of my destination and i get it .. i dont use url path just the path of the server.. thanks by the way :)Cypress
if that ain'T working i cannot help you further more. Like i said, you can ignore this warning... Or turn log level down with -loglevel 8 or -loglevel 16. See the docs: ffmpeg.org/ffmpeg.htmlScutum
I get error when typing 422 instead of 420: deprecated pixel format used, make sure you did set range correctly No pixel format specified, yuv422p for H.264 encoding chosen. Use -pix_fmt yuv420p for compatibility with outdated media players.Chum
Hey, I can't ignore it because I try to stream something and I get this warning 5 times a second flooding my terminal. What should I do than?Wolfish
@KonradLinkowski: at least a couple of options: (1) turn off warning output from ffmpeg, e.g. with -loglevel error; (2) update your input data to not have colors with component values outside the range 16–235 (see superuser.com/a/1273941/57367 ) [how to do that depends on how the input is generated/sourced, of course, so I can't answer that here, but in my case, just using very light and dark greys instead of white and black in my image generator worked great]. One or the other of those should quiet things down.Piazza
C
0

I just change the path of the destination of the image:

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

Then used the following:

# $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");  
Cypress answered 27/3, 2017 at 5:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.