首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >使用ffmpeg将yuv视频转换为png帧

使用ffmpeg将yuv视频转换为png帧
EN

Stack Overflow用户
提问于 2015-08-24 11:04:32
回答 2查看 10.4K关注 0票数 2

我想用ffmpeg将一个yuv视频转换成png帧。

我使用的命令是

/root/bin/ffmpeg -i pirkagia_max_vid_qual_one.yuv -s 720x576 -r 25 -pix_fmt yuv420p -f image2 one/image-%3d.png

我得到以下答复:

ffmpeg version git-2015-08-07-8015150 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16) configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 libavutil 54. 30.100 / 54. 30.100 libavcodec 56. 57.100 / 56. 57.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 32.100 / 5. 32.100 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 [IMGUTILS @ 0x7fffe8e84760] Picture size 0x0 is invalid [IMGUTILS @ 0x7fffe8e84310] Picture size 0x0 is invalid [rawvideo @ 0x3aaf160] Could not find codec parameters for stream 0 (Video: rawvideo (I420 / 0x30323449), yuv420p, -4 kb/s): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options pirkagia_max_vid_qual_one.yuv: could not find codec parameters Input #0, rawvideo, from 'pirkagia_max_vid_qual_one.yuv': Duration: N/A, bitrate: N/A Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, -4 kb/s, 25 tbr, 25 tbn, 25 tbc Output #0, image2, to 'one/image-%3d.png': Output file #0 does not contain any stream

有什么想法吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-08-24 17:39:59

在您的例子中,rawvideo需要更多的信息。由于您的输入中似乎没有指定视频参数的头,所以必须指定它们,以便能够正确地解码数据。示例:

代码语言:javascript
代码运行次数:0
运行
复制
ffmpeg -pixel_format yuv420p -video_size 720x576 -framerate 25 -i …

另外,对于PNG编码器来说,yuv420p是不兼容的,所以您可以删除它作为输出选项,并自动选择合适的像素格式。

票数 3
EN

Stack Overflow用户

发布于 2021-08-04 14:35:19

代码语言:javascript
代码运行次数:0
运行
复制
import os

num = 1
video_name = ['out.yuv']
short = ['yuv']

for i in range(num):
    saveroot = 'images/' + short[i]
    savepath = 'images/' + short[i] + '/im%03d.yuv'

    if not os.path.exists(saveroot):
        os.makedirs(saveroot)

    print('ffmpeg -y -pix_fmt yuv420p -s 1920x1024 -i ' + 'videos_crop/' + video_name[i] +  ' ' + savepath)

    os.system('ffmpeg -y -pix_fmt yuv420p -s 1920x1024 -i ' +  'videos_crop/' + video_name[i] +  ' ' + savepath)
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32180747

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档