問題描述
這是我使用 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 (默認)元數據:創(chuàng)作時間: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 正確設置了范圍"……有人可以檢查我下面的代碼嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!