1. Install FFmpeg
- Apple platform: Brew is recommended for installation
- Install BREW from the command line
- brew install ffmpeg
- Windows platform with chocolatey package management tool to install
- Install Chocolatey from the command line
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
- choco install ffmpeg
- Install Chocolatey from the command line
- Installation on Linux
- sudo apt install ffmpeg
2. The audio
2.1
(1) <audio controls SRC ="gm.mp3"></audio> (2) in terminal: FFmpeg -i gm.mp3 gm.ogg <audio controls> <source src="gm.ogg"></source> <source src="gm.mp3"></source> </audio>Copy the code
3. The video
(1) <video controls SRC =" s8L.mp4 "></video> FFmpeg -i S8L.mp4 S8L.ogg <video controls> <source src="S8L.ogv"></source> <source src="S8L.mp4"></source> </video>Copy the code
4. The microphone
(async function() { let devices = navigator.mediaDevices.enumerateDevices(); console.log(devices) let stream = navigator.mediaDevices.getUserMedia({video: false, audio: true}); Document.queryselector ("audio").srcobject = stream; }) ();Copy the code