FFmpeg命令 ---- 提取数据

提取音视频数据

保留封装格式
ffmpeg -i test.mp4 -acodec copy -vn audio. mp4
ffmpeg -i test.mp4 -vcodec copy -an video.mp4

提取视频

保留编码格式:ffmpeg -i test.mp4 -vcodec copy -an test_copy.h264

强制格式:ffmpeg -i test.mp4 -vcodec libx264 -an test.h264

提取音频
保留编码格式:ffmpeg -i test.mp4 -acodec copy -vn test.aac

强制格式:ffmpeg -i test.mp4 -acodec libmp3lame -vn test.mp3

提取像素格式和PCM数据

提取YUV

提取3秒数据分辨率和源视频一致

ffmpeg -i test_1280x720.mp4 -t 3 -pix_fmt yuv420p yuv420p_orig.yuv

提取3秒数据分辨率转为320x240

ffmpeg -i test_1280x720.mp4 -t 3 -pix_fmt yuv420p -s 320x240 yuv420p_320x240.yuv

提取RGB

提取3秒数据,分辨率转为320x240

ffmpeg -i test.mp4 -t 3 -pix_fmt rgb24 -s 320x240 rgb24_320x240.rgb

RGB和YUV之间的转换

ffmpeg -s 320x240 -pix_fmt yuv420p -i yuv420p_320x240.yuv -pix_fmt rgb24 rgb24_320x240_2.rgb

原文地址:https://www.cnblogs.com/vczf/p/13471690.html