JS video player with ffmpeg HTTP streaming in PHP: state machine, watchdog, subtitles
The article discusses the development of a JavaScript video player that utilizes ffmpeg for HTTP streaming in PHP. It outlines the challenges faced when streaming various video formats and the solutions implemented to handle them. The author details the server-side and client-side components of the player, including streaming modes and performance optimizations.
- ▪The video player was tested with an 8 GB MKV file, which initially failed to play due to format incompatibilities.
- ▪Three streaming modes were developed: native streaming for compatible files, remuxing for H.264 MKVs, and transcoding for unsupported codecs.
- ▪A PHP semaphore was implemented to manage concurrent ffmpeg processes and prevent CPU resource contention.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3833552) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } Odilon HUGONNOT Posted on May 22 • Originally published at web-developpeur.com JS video player with ffmpeg HTTP streaming in PHP: state machine, watchdog, subtitles #javascript #ffmpeg #php #streaming The first real test of ShareBox with an actual file was an 8 GB MKV — HEVC encode, DTS audio, PGS subtitles burned from a Japanese Blu-ray. The <video src="..."> I had put in place opened, spun for two seconds, and stopped in complete silence. No error event, no console message.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).