Ask HN: Share your FFmpeg settings for video hosting
A user is developing a video hosting site allowing MP4 uploads, utilizing H.264 for video and Opus for audio. They seek advice on encoding settings and challenges faced in the process.
The user is developing a video hosting website that allows users to upload video files, which will then be processed to create multiple versions with varying qualities, audio tracks, and thumbnails. The chosen format for video files is MP4 due to its broad compatibility. To enhance user experience, the fast start option is utilized, placing the metadata at the beginning of the file to allow quicker playback. The H.264 codec has been selected for video encoding, as it is widely supported and often outperforms hardware encoding due to its optimized software encoding capabilities. This choice is particularly relevant since users are expected to upload already compressed videos rather than high-resolution raw footage. For audio, the Opus codec is preferred for its efficiency. The user employs FFmpeg for video conversion, using specific command-line options to set parameters such as video and audio bitrates, dimensions, and channel layouts. The user seeks advice from others in the video encoding field regarding their settings, challenges faced, and any tips they might have, acknowledging that this is a specialized area beyond typical consumer use.
Related
How Video Works
The site explains video playback intricacies, including subtitles, adaptive streaming, HLS, DASH technologies, and player selection for optimal streaming experience. Fast delivery and adaptive bitrate enhance viewing quality.
We increased our rendering speeds by 70x using the WebCodecs API
Revideo, a TypeScript framework, boosted rendering speeds by 70 times with WebCodecs API. Challenges overcome by browser-based video encoding. Limited audio processing and browser compatibility remain.
Writing an MP4 Muxer for Fun and Profit
The latest OBS update introduces a new "Hybrid MP4" output format to improve data loss and compatibility issues. It combines fragmented and regular MP4 files, offering enhanced features and collaboration with FFmpeg.
My ffmpeg how-to/examples/scratchfile can be viewed here: https://paste.travisflix.com/?ce12a91f222cc3d7#BQPKtw6sEs9cE...
You should have a low bandwidth setting that also uses new codecs.
Like 64kbit stereo opus is to my ears almost imperceptible to CD audio. I think listening tests by professionals recommend using between 64kbit to 96kbit for perfect audio.
Anything beyond is a waste unless we are talking about more than stereo.
Also if you want, you can use mpeg dash to stream video. Here you encode video into small series of chunks/files. When player can't handle high bandwidth, it can switch to lower bandwidth automatically, and vice versa. This is what YouTube and any professional places do. This will also help prevent users from easily downloading complete video. The trick is that you will need to ensure all videos are split on same key frame, so either use two pass encoding, or define that every ?3? seconds exactly is a new video file.
https://www.cloudflare.com/en-ca/learning/video/what-is-mpeg...
The settings are picked based on what format, resolution, bitrate, and codec I'd like. I don't think this is something you need to spend time nitpicking, admittedly. :)
You mention you're working on a site for video hosting. Have you thought about how you're going to deliver video at scale? Sending video over the wire is super expensive and your costs will probably increase faster than your revenue, unless you're charging out the gate. Cloudflare has some plans which let you deliver for nearly free, but your content needs to be fairly static.
Good luck! Don't sweat the small stuff - just keep building.
As for your command line, what do you think -g 52 does? Why do you give conflicting audio channel settings?
If you can restrict support to just current Android, Chrome, and Firefox, you can use VP9, Opus, and SRT. Willfully-outdated platforms like Apple and Roku have screwed over everyone.
Don't think your end customers will care who's serving the video?
Care to share what the site is?
Related
How Video Works
The site explains video playback intricacies, including subtitles, adaptive streaming, HLS, DASH technologies, and player selection for optimal streaming experience. Fast delivery and adaptive bitrate enhance viewing quality.
We increased our rendering speeds by 70x using the WebCodecs API
Revideo, a TypeScript framework, boosted rendering speeds by 70 times with WebCodecs API. Challenges overcome by browser-based video encoding. Limited audio processing and browser compatibility remain.
Writing an MP4 Muxer for Fun and Profit
The latest OBS update introduces a new "Hybrid MP4" output format to improve data loss and compatibility issues. It combines fragmented and regular MP4 files, offering enhanced features and collaboration with FFmpeg.