大贤者
精华
|
战斗力 鹅
|
回帖 0
注册时间 2020-4-13
|
本帖最后由 Gazzz 于 2023-10-8 21:26 编辑
随机从X下一个视频,大小是320x426
- A:~$ ffprobe -i kb31H6uIzH0ghDW1.mp4
- ffprobe version 3.4.13 Copyright (c) 2007-2023 the FFmpeg developers
- built with gcc 12 (Debian 12.2.0-14)
- configuration: --enable-shared
- libavutil 55. 78.100 / 55. 78.100
- libavcodec 57.107.100 / 57.107.100
- libavformat 57. 83.100 / 57. 83.100
- libavdevice 57. 10.100 / 57. 10.100
- libavfilter 6.107.100 / 6.107.100
- libswscale 4. 8.100 / 4. 8.100
- libswresample 2. 9.100 / 2. 9.100
- Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'kb31H6uIzH0ghDW1.mp4':
- Metadata:
- major_brand : mp42
- minor_version : 0
- compatible_brands: mp42mp41iso4
- creation_time : 2023-10-08T12:21:06.000000Z
- Duration: 00:00:03.92, start: 0.000000, bitrate: 221 kb/s
- Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 320x426, 216 kb/s, 30.10 fps, 30 tbr, 600 tbn, 1200 tbc (default)
- Metadata:
- creation_time : 2023-10-08T12:21:06.000000Z
- handler_name : Vireo Eyes v2.9.1
- encoder : AVC Coding
复制代码
统计帧数
- A:~$ ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of default=nokey=1:noprint_wrappers=1 kb31H6uIzH0ghDW1.mp4
- 118
复制代码
转换为bmp
- A:~/images$ ffmpeg -i kb31H6uIzH0ghDW1.mp4 -pix_fmt bgr24 "out-%03d.bmp"
- #ls观察确实生成了118张图片
- A:~/images$ file out-001.bmp
- out-001.bmp: PC bitmap, Windows 3.x format, 320 x 426 x 24, image size 408960, cbSize 409014, bits offset 54
复制代码
转换为压缩的tiff
- A:~/images$ ffmpeg -i kb31H6uIzH0ghDW1.mp4 -pix_fmt rgb24 "out-%03d.tiff"
- A:~/images$ file out-001.tiff
- out-001.tiff: TIFF image data, little-endian, direntries=14, height=426, bps=17567, compression=PackBits (Macintosh RLE), PhotometricInterpretation=RGB, width=320
复制代码
转换为不压缩的tiff
- A:~/images$ ffmpeg -i kb31H6uIzH0ghDW1.mp4 -compression_algo raw -pix_fmt rgb24 "out-%03d.tiff"
- A:~/images$ file out-001.tiff
- out-001.tiff: TIFF image data, little-endian, direntries=14, height=426, bps=15752, compression=none, PhotometricInterpretation=RGB, width=320
复制代码
至于ffmpeg的安装方法,网上应该应该很容易能搜到,直接搜"Windows ffmpeg 安装"就行,mac/Linux用户那就直接用包管理安装就可以,一般也都带了libtiff的 |
|