当前位置:网站首页>VB.net 调用FFmpeg简单处理视频(类库——6)
VB.net 调用FFmpeg简单处理视频(类库——6)
2022-07-04 04:58:00 【小虞163】
网上也有很多C#教程关于FFmpeg处理视频的,其实换到VB.net,还是一样的
先从网上下载到FFmpeg.exeFFmpeg-FFmpeg
再把FFmpeg.exe拖入自己的应用程序文件夹下
由于是跟类库有关的,可以翻我之前写的调用(类库1-5)
现在打开我们的类库,新建一个类(随便取名):VideoProcess
Public Class VideoProcess
''' <summary>
''' 给视频添加音频,注意视频和音频时长
''' </summary>
''' <param name="ffmpeg">给的FFmpeg绝对路径</param>
''' <param name="mp3">给的音频路径</param>
''' <param name="video">给的视频路径</param>
''' <param name="out">输出视频的路径</param>
''' <returns>null</returns>
Public Function AddAudio(ffmpeg As String, mp3 As String, video As String, out As String)
Process.Start(ffmpeg, "-i " & video & " -i " & mp3 & " -codec copy " & out)
Return vbNull
End Function
''' <summary>
''' 给视频删除音频,注意原视频的视频时长和原音频的时长
''' </summary>
''' <param name="ffmpeg">给的FFmpeg绝对路径</param>
''' <param name="video">给的视频路径</param>
''' <param name="out">输出视频的路径</param>
''' <returns>null</returns>
Public Function DeleteAudio(ffmpeg As String, video As String, out As String)
Process.Start(ffmpeg, "-i " & video & " -c:v copy -an " & out)
Return vbNull
End Function
End Class
提前在桌面上放一个音频,一个视频
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
GDIvid.AddAudio(Application.StartupPath & "\ffmpeg.exe", "C:\Users\Administrator\Desktop\105.mp3", "C:\Users\Administrator\Desktop\test.mp4", "C:\Users\Administrator\Desktop\test1.mp4")
End Sub
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
GDIvid.DeleteAudio(Application.StartupPath & "\ffmpeg.exe", "C:\Users\Administrator\Desktop\test1.mp4", "C:\Users\Administrator\Desktop\test2.mp4")
End Sub添加音频后,视频的时长会改变
边栏推荐
- Zhongke Panyun - data analysis and forensics packet flag
- 【MATLAB】MATLAB 仿真数字带通传输系统 — ASK、 PSK、 FSK 系统
- Annex 2-2 confidentiality commitment docx
- Public inputs in appliedzkp zkevm (13)
- [matlab] general function of communication signal modulation Fourier transform
- Annex I: power of attorney for 202x XXX attack and defense drill
- Just do it with your hands 7 - * project construction details 2 - hook configuration
- LM small programmable controller software (based on CoDeSys) note 22: error 4268/4052
- NTFS security permissions
- [技术发展-25]:广播电视网、互联网、电信网、电网四网融合技术
猜你喜欢
![[QT] timer](/img/df/5db6af851ef19f33fd7e7a7ed46586.png)
[QT] timer
![[interested reading] advantageous filtering modeling on long term user behavior sequences for click through rate pre](/img/3e/b5df691ca1790469eb1b4e8ea5b4c0.png)
[interested reading] advantageous filtering modeling on long term user behavior sequences for click through rate pre

Integer type of C language

【QT】制作MyComboBox点击事件

Trie数-字典树

空洞卷积、可变形卷积、可变形ROI Pooling

Evolution of system architecture: differences and connections between SOA and microservice architecture

模拟小根堆

Flutter ‘/usr/lib/libswiftCore. dylib‘ (no such file)

LM小型可编程控制器软件(基于CoDeSys)笔记二十一:错误3703
随机推荐
Flutter ‘/usr/lib/libswiftCore. dylib‘ (no such file)
Integer type of C language
ping端口神器psping
Just do it with your hands 7 - * project construction details 2 - hook configuration
[matlab] matlab simulation modulation system - DSB system
Secondary vocational group network security - memory Forensics
【MATLAB】MATLAB 仿真数字基带传输系统 — 双极性基带信号(第 I 类部分响应波形)的眼图
令人头痛的延时双删
[technology development -25]: integration technology of radio and television network, Internet, telecommunication network and power grid
中科磐云—2022广西逆向解析思路
June 2022 summary
Using jsts in esmodule environment
Roles of rollup components
Headache delayed double deletion
练习-冒泡排序
PostgreSQL has officially surpassed mysql. Is this guy too strong!
[matlab] matlab simulates digital baseband transmission system eye diagram of bipolar baseband signal (class I part response waveform)
Annex III: scoring standard of the defender docx
Customize a pager needed in your project
[matlab] matlab simulation - simulate the AM modulation process of the modulation system