Fundamentals of Audio/Video Encoding and ffmpeg Command Basics
This article introduces ffmpeg as a powerful multimedia framework, explains container formats, bitrate, resolution, and frame rate concepts, outlines key live‑streaming performance metrics, and provides essential ffmpeg command‑line options and examples for streaming and transcoding.
ffmpeg is a leading multimedia processing framework that supports encoding, decoding, transcoding and runs on Linux, macOS and Windows.
Video files use container formats (e.g., avi, rmvb, mp4, flv, mkv) that package audio and video streams; tools like MediaInfo reveal details such as resolution, bitrate and frame rate.
Bitrate (bits per second) determines data flow; higher bitrate yields clearer video. Frame rate (FPS) measures frames displayed per second and affects smoothness, especially in games.
Key performance indicators for live streaming include latency (time difference between send and receive), stutter rate (number of playback interruptions), and first‑frame time (time to display the first decoded frame).
Common ffmpeg command‑line options include -i for input file, -b:v to set video bitrate, -s for resolution, -r for frame rate, -c:v libx264 for H.264 encoding, and -re to send at native frame rate.
Example commands:
Stream: ffmpeg -re -i localFile.mp4 -c copy -f flv rtmp://ps0.xxx.com/xxx
Play stream: ffplay http://pl0.xxx.com/xxx/xxx.flv
Transcode to H.264 MP4: ffmpeg -i D:/test.mov -c:v libx264 -strict -2 D:/test.mp4
Change bitrate: ffmpeg -i test.mp4 -b:v 1500k testk.mp4
Change resolution: ffmpeg -i D:/test/test.mp4 -s 800x600 D:/test/testf.mp4
Change frame rate: ffmpeg -i D:/test/test.mp4 -r 25 D:/test/testr.mp4
Probe stream info: ffprobe http://pl0.xxx.com/xxx/xxx.flv
For more details, refer to the official ffmpeg website: http://ffmpeg.org/.
360 Quality & Efficiency
360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.