All Projects → jordicenzano → Hls Trimming Frame Accuracy

jordicenzano / Hls Trimming Frame Accuracy

Licence: gpl-3.0
JS Code that given a group of HLS chunks, a start timestamp, and end timestamp it creates one MP4 that contains the original V/A frame accuracy trimmed and perfectly aligned

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Hls Trimming Frame Accuracy

SharpGrabber
Download from YouTube, Vimeo, PornHub, HLS (M3U8 files) with .NET and JavaScript, Library and desktop app for downloading high quality media
Stars: ✭ 138 (+200%)
Mutual labels:  ffmpeg, hls
Awesome Video
A curated list of awesome streaming video tools, frameworks, libraries, and learning resources.
Stars: ✭ 397 (+763.04%)
Mutual labels:  ffmpeg, hls
Python Ffmpeg Video Streaming
📼 Package media content for online streaming(DASH and HLS) using FFmpeg
Stars: ✭ 269 (+484.78%)
Mutual labels:  ffmpeg, hls
cassandra-nginx-cdn
Some config files and POC code to use Apache Cassandra as distributed storage for HLS chunks accross multiple datacenters and scripts for converting/transcoding UDP MPEG-TS to HLS and vice versa. The idea is take from Globo.com’s Live Video Platform for FIFA World Cup ’14.
Stars: ✭ 24 (-47.83%)
Mutual labels:  ffmpeg, hls
Docker Nginx Rtmp
🐋 A Dockerfile for nginx-rtmp-module + FFmpeg from source with basic settings for streaming HLS. Built on Alpine Linux.
Stars: ✭ 608 (+1221.74%)
Mutual labels:  ffmpeg, hls
Huong-dan-cai-dat-stream-server-va-chuyen-doi-video-sang-streaming
Hướng dẫn cài đặt stream server và chuyển đổi video thường sang dạng TS Streaming
Stars: ✭ 29 (-36.96%)
Mutual labels:  ffmpeg, hls
Php Practice
🌹 一天一点点,积少成多...
Stars: ✭ 351 (+663.04%)
Mutual labels:  ffmpeg, hls
transport-stream-online-segmenter
Transport stream web based HLS segmenter.
Stars: ✭ 30 (-34.78%)
Mutual labels:  hls, chunk
Janus Webrtc Gateway Docker
Perfect Docker Image for Media Streaming Expert User ( https://github.com/meetecho/janus-gateway )
Stars: ✭ 582 (+1165.22%)
Mutual labels:  ffmpeg, hls
Iptv
一键安装管理 FFmpeg / nginx / openresty / xray / v2ray / armbian / proxmox / cloudflare partner,workers / ibm cloud foundry 脚本
Stars: ✭ 481 (+945.65%)
Mutual labels:  ffmpeg, hls
nott
The New OTT Platform - an excuse to discuss and design a simple edge computing platform
Stars: ✭ 46 (+0%)
Mutual labels:  ffmpeg, hls
Laravel Ffmpeg
This package provides an integration with FFmpeg for Laravel. Laravel's Filesystem handles the storage of the files.
Stars: ✭ 807 (+1654.35%)
Mutual labels:  ffmpeg, hls
reisen
A simple library to extract video and audio frames from media containers (based on libav).
Stars: ✭ 41 (-10.87%)
Mutual labels:  ffmpeg, frame
adif
用标准c语言开发的常用数据结构和算法基础库,作为应用程序开发接口基础库,为编写高性能程序提供便利,可极大地缩短软件项目的开发周期,提升工程开发效率,并确保软件系统运行的可靠性、稳定性。
Stars: ✭ 33 (-28.26%)
Mutual labels:  chunk, frame
smart rtmpd
RTMP server, smart, compact, high performance(c, c++), high concurrency, easy to maintain, easy to deploy, (supports multiple operating systems Windows and Linux, ARM, FreeBSD)
Stars: ✭ 159 (+245.65%)
Mutual labels:  ffmpeg, hls
Awesome Live Stream
Webrtc && Nginx && DASH && Quic 学习资料收集,持续更新中
Stars: ✭ 290 (+530.43%)
Mutual labels:  ffmpeg, hls
Digital video introduction
A hands-on introduction to video technology: image, video, codec (av1, vp9, h265) and more (ffmpeg encoding).
Stars: ✭ 12,184 (+26386.96%)
Mutual labels:  ffmpeg, hls
Php Ffmpeg Video Streaming
📼 Package media content for online streaming(DASH and HLS) using FFmpeg
Stars: ✭ 246 (+434.78%)
Mutual labels:  ffmpeg, hls
Gohls
A server that exposes a directory for video streaming via web interface
Stars: ✭ 409 (+789.13%)
Mutual labels:  ffmpeg, hls
Ffmpeg
Mirror of https://git.ffmpeg.org/ffmpeg.git
Stars: ✭ 27,382 (+59426.09%)
Mutual labels:  ffmpeg, hls

HLS super fast frame accuracy trimming (JS)

Image of HLS trimming

#Usage

  • Install: ffmpeg and nodejs
  • Ensure ffmpeg is in the PATH
  • Use this syntax: ./trim_hls_frame_acc source_hls dest_file tmp_dir trim_in trim_out
    • Example1: ./trim_hls_frame_acc /hls_test/ /out/test.mp4 /tmp 10.0 21.2
    • Example2: ./trim_hls_frame_acc /hls_test/test.m3u8 /out/test.mp4 /tmp 10.0 21.2

#Description

  • This code is an evolution of this code: [Trim HLS stream with frame accuracy using ffmpeg and Bash script](https://jordicenzano.name/2014/08/07/trim-hls-stream-with-frame-accuracy-using-ffmpeg-and-bash-script-2/)
  • The purpose of this code gets a group if HLS chunks (.ts) and input and output timestamps and creates an output mp4 file frame accuracy trimmed, AV perfectly aligned, and thanks to the underlying algorithm in a very small amount of time.
  • It can be useful to:
    • On the fly live streaming trimming (highlights)
    • VOD frame accuracy trimming
    • Increase dramatically the speed of video editors (mostly cloud video editors)

#How it works

  1. Based on the in an out points analyze the input files an establish which are the first and last segments
  2. Split A/V of the necessary chunks, creating a .ts (video only) and .acc files. It is just a parsing operation.
  3. For the first and the last chunks:
    • Get video frame position information from and calculate the video cutting point to preserve frame accuracy
    • Decode to YUV
    • Encode the trimmed YUV to the same codec as the original files
  4. Concatenate the video segments to a final video .ts
  5. For the first and the last audio chunks:
    • Get audio frame position information and calculate the audio cutting points based on video cutting points to preserve A/V alignment
    • Calculate AV delay necessary at the output file to preserve AV alignment
    • Trim the stream at packet level
  6. Concatenate the audio segments to a final audio .aac
  7. Mux final video and final audio file to MP4 preserving the previously calculated A/V delay

#Assumptions

  • The video codec is H264 and the audio coded is aac
  • All the chunks start with and I frame (wowza forces an I frame at start of chunks, event the transmuxed ones)
  • Only 1 video and 1 audio present in the input files
  • If you use hls manifest (.m3u8) as a source, only relative local paths are allowed
  • The A/V delay in the original stream is reasonable (<2s)

#Future work

  • Make the code usable for any input different than HLS
  • Apply multi-threaded processing in some stages to speed up the process (reasonable goal is to increase the speed x2)
  • Modify the code to process the input files at video GOP level (not chunk level)
    • Increase the processing speed (GOPs use to be smaller than chunks)
    • No need that chunks start with I frame
    • Easier to handle other formats different than HLS
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].