这个命令会打开视频文件
D:/ffmpeg_command_test/001.mp4
并提取其中的视频流。选项
-an
表示不处理音频流,只处理视频流。
-c:v copy
指定输出视频的编码格式保持不变,即直接复制原始的H.264视频数据。最后,
output.h264
指定了输出文件的名称和格式,这里是H.264视频文件。
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:/ffmpeg_command_test/001.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.19.100
Duration: 00:00:31.18, start: 0.000000, bitrate: 879 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 640x352, 748 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Output #0, h264, to 'D:/ffmpeg_command_test/001.h264':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf60.13.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 640x352, q=2-31, 748 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[out#0/h264 @ 00000210a5c456c0] video:2835kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.018602%
frame= 744 fps=0.0 q=-1.0 Lsize= 2835kB time=00:00:30.90 bitrate= 751.5kbits/s speed= 268x
提取pcm数据
ffmpeg -i D:/ffmpeg_command_test/001.mp4 -vn -ar 44100 -ac 2 -f s16le D:/ffmpeg_command_test/001.pcm
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '001.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.19.100
Duration: 00:00:31.18, start: 0.000000, bitrate: 879 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 640x352, 748 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, s16le, to '001.pcm':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf60.13.100
Stream #0:0(und): Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
encoder : Lavc60.27.100 pcm_s16le
[out#0/s16le @ 000002329025e340] video:0kB audio:5374kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
size= 5374kB time=00:00:31.17 bitrate=1412.3kbits/s speed= 362x
然后可以使用ffplay播放
ffplay -ar 44100 -ac 2 -f s16le D:/ffmpeg_command_test/001.pcm
抽取MP3音频
ffmpeg -i D:/ffmpeg_command_test/001.mp4 -vn -aframes 180 -acodec libmp3lame -ac 2 -ar 48000 -y 001_0.mp3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:/ffmpeg_command_test/001.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: mp42iso2avc1mp41
creation_time : 2022-03-18T01:43:06.000000Z
encoder : HandBrake 1.5.1 2022011000
Duration: 00:00:15.02, start: 0.000000, bitrate: 1131 kb/s
Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x240 [SAR 60:259 DAR 480:259], 989 kb/s, 23.87 fps, 23.98 tbr, 90k tbn (default)
Metadata:
creation_time : 2022-03-18T01:43:06.000000Z
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 135 kb/s (default)
Metadata:
creation_time : 2022-03-18T01:43:06.000000Z
handler_name : Stereo
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:1 -> #0:0 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to 'D:/ffmpeg_command_test/001_0.mp3':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: mp42iso2avc1mp41
TSSE : Lavf59.27.100
Stream #0:0(eng): Audio: mp3, 48000 Hz, stereo, fltp (default)
Metadata:
creation_time : 2022-03-18T01:43:06.000000Z
handler_name : Stereo
vendor_id : [0][0][0][0]
encoder : Lavc59.37.100 libmp3lame
size= 68kB time=00:00:04.29 bitrate= 129.3kbits/s speed=92.1x
video:0kB audio:68kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.491898%
这是提取出来的mp3文件的信息:
Input #0, mp3, from 'D:/ffmpeg_command_test/001_0.mp3':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: mp42iso2avc1mp41
encoder : Lavf59.27.100
Duration: 00:00:04.32, start: 0.023021, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc59.37
Stream mapping:
Stream #0:0 -> #0:0 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
Output #0, adts, to 'D:/ffmpeg_command_test/001_1.aac':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: mp42iso2avc1mp41
encoder : Lavf59.27.100
Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc59.37.100 aac
size= 69kB time=00:00:04.30 bitrate= 131.2kbits/s speed=44.5x
video:0kB audio:68kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.051482%
[aac @ 0000026a0d7dcdc0] Qavg: 732.265
分别抽取视频和音频,然后进行合并
ffmpeg -i D:/ffmpeg_command_test/001.mp4 -vcodec copy -an -y D:/ffmpeg_command_test/001_2.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:/ffmpeg_command_test/001.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.19.100
Duration: 00:00:31.18, start: 0.000000, bitrate: 879 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 640x352, 748 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 000002874d9c0d00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000002874d9c0d00] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 000002874d9c0d00] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=11 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'D:/ffmpeg_command_test/modified_video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf60.13.100
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(progressive), 640x352, q=2-31, 23.98 fps, 24k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
encoder : Lavc60.27.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
encoder : Lavc60.27.100 aac
[out#0/mp4 @ 000002874d9a1100] video:2555kB audio:463kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.810708%
frame= 744 fps=270 q=-1.0 Lsize= 3042kB time=00:00:31.18 bitrate= 799.1kbits/s speed=11.3x
[libx264 @ 000002874d9c0d00] frame I:20 Avg QP:17.33 size: 23676
[libx264 @ 000002874d9c0d00] frame P:241 Avg QP:22.45 size: 6013
[libx264 @ 000002874d9c0d00] frame B:483 Avg QP:24.80 size: 1435
[libx264 @ 000002874d9c0d00] consecutive B-frames: 6.9% 16.9% 8.5% 67.7%
[libx264 @ 000002874d9c0d00] mb I I16..4: 33.8% 22.6% 43.6%
[libx264 @ 000002874d9c0d00] mb P I16..4: 5.5% 8.8% 3.1% P16..4: 30.1% 12.1% 7.1% 0.0% 0.0% skip:33.2%
[libx264 @ 000002874d9c0d00] mb B I16..4: 0.8% 0.7% 0.4% B16..8: 29.5% 4.7% 1.6% direct: 2.4% skip:60.1% L0:44.5% L1:42.4% BI:13.1%
[libx264 @ 000002874d9c0d00] 8x8 transform intra:40.7% inter:47.7%
[libx264 @ 000002874d9c0d00] coded y,uvDC,uvAC intra: 44.8% 48.8% 15.7% inter: 12.0% 10.7% 0.5%
[libx264 @ 000002874d9c0d00] i16 v,h,dc,p: 38% 36% 13% 13%
[libx264 @ 000002874d9c0d00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 33% 21% 3% 5% 5% 6% 4% 6%
[libx264 @ 000002874d9c0d00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 30% 13% 5% 7% 7% 8% 6% 8%
[libx264 @ 000002874d9c0d00] i8c dc,h,v,p: 53% 31% 11% 5%
[libx264 @ 000002874d9c0d00] Weighted P-Frames: Y:32.8% UV:28.2%
[libx264 @ 000002874d9c0d00] ref P L0: 64.0% 19.5% 13.2% 2.9% 0.3%
[libx264 @ 000002874d9c0d00] ref B L0: 89.6% 8.6% 1.8%
[libx264 @ 000002874d9c0d00] ref B L1: 98.3% 1.7%
[libx264 @ 000002874d9c0d00] kb/s:674.29
[aac @ 000002874fa1a8c0] Qavg: 5440.482
版权声明:本文内容转自互联网,本文观点仅代表作者本人。本站仅提供信息存储空间服务,所有权归原作者所有。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至[email protected] 举报,一经查实,本站将立刻删除。
赞
(0)
摩尔线程与云宏完成产品兼容互认证,满足虚拟化应用市场需求
2023 年海外虚拟会议平台供应商
3SS的3Ready平台集成了新的YouTube推荐API,为视频服务提供商和汽车制造商带来内容丰富的体验
Mitel完成收购Unify,加强统一通信产品阵容
Pixellot 推出 Show S3 摄像机,为 AI 自动化体育视频制作引入新标准
苹果新专利曝光:未来 XR 头显、AR 眼镜等产品或搭载健康监测传感器
增强WebRTC视频流: 添加文本、图像和二维码
谁将在 2024 年引领 CPaaS 领域?Omdia 公布调查结果
边缘计算,原来早就在你我身边
量子加密研究新突破!新安全协议确保与“对的人”通信