如何使用ffmpeg正确提取变形视频帧?

时间:2019-05-11 20:21:07

标签: ffmpeg pixel

我可以使用下面的ffmpeg提取帧,但结果是720x576正方形像素,而不是变形非正方形1024x576。如何输出电视上显示的720x576矩形像素?

在隔行输出时如何对帧进行隔行扫描?

ffmpeg -i Midnight.vob -vf fps=1,setdar=16:9 -q:v 2 Midnight%06d.jpg

我如何在下面的ffmpeg中处理此问题。

  

[swscaler @ 0000000002a8ec40]已弃用的像素格式,请确保   您没有正确设置范围。视频:mjpeg,yuvj420p(pc)。

我是否了解视频颜色格式已经过时,并且(pc)颜色的范围是0-255?

ffmpeg -i Midnight.vob -vf fps=1,setdar=16:9 -q:v 2 Midnight%06d.jpg ffmpeg version N-93828-g68bac50604 Copyright (c) 2000-2019 the FFmpeg developers

built with gcc 8.3.1 (GCC) 20190414 configuration: --enable-gpl
--enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt libavutil      56. 26.101 / 56. 26.101 libavcodec     58. 52.101 / 58.
52.101 libavformat    58. 27.103 / 58. 27.103 libavdevice    58.  7.100 / 58.  7.100 libavfilter     7. 50.100 /  7. 50.100 libswscale      5.  4.100 /  5.  4.100 libswresample   3.  4.100 /  3.  4.100 libpostproc    55.  4.100 / 55.  4.100 Input #0, mpeg, from 'Midnight.vob':   Duration: 00:42:04.58, start: 0.287267, bitrate: 5829 kb/s
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:3[0x81]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:4[0x82]: Audio: ac3, 48000 Hz, mono, fltp, 192 kb/s
    Stream #0:5[0x22]: Subtitle: dvd_subtitle
    Stream #0:6[0x24]: Subtitle: dvd_subtitle
    Stream #0:7[0x25]: Subtitle: dvd_subtitle
    Stream #0:8[0x26]: Subtitle: dvd_subtitle
    Stream #0:9[0x28]: Subtitle: dvd_subtitle
    Stream #0:10[0x21]: Subtitle: dvd_subtitle
    Stream #0:11[0x23]: Subtitle: dvd_subtitle Stream mapping:   Stream #0:1 -> #0:0 (mpeg2video (native) -> mjpeg (native)) Press [q] to stop, [?] for help [swscaler @ 000000000295ec40] deprecated pixel format used, make sure you did set range correctly Output #0, image2, to 'Midnight%06d.jpg':   Metadata:
    encoder         : Lavf58.27.103
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 720x576 [SAR 36:5 DAR 9:1], q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc
    Metadata:
      encoder         : Lavc58.52.101 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 [mpeg @ 0000000000400340] New subtitle stream 0:12 at pos:7458830 and DTS:12.4873s [mpeg @ 0000000000400340] New subtitle stream 0:13 at pos:7475214 and DTS:12.4873s frame=  951 fps=115 q=2.0 Lsize=N/A time=00:15:51.00 bitrate=N/A speed= 115x

video:49190kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

为大jpg渲染而设置,然后缩小到1024x576。如果去隔行,则删除yadif = 1。

ffmpeg -i input.vob -vf yadif=1,scale=4096x2304,setdar=16:9 -qmin 1 -q:v 1 output%06d.jpg

jpg是原始尺寸1024x576正方形像素。

ffmpeg -i input.vob -vf yadif=1,fps=1,scale=iw*sar:ih,setsar=1 -qmin 1 -q:v 1 output%06d.jpg

Png比jpg的质量更好。

感谢您的贡献。

0 个答案:

没有答案