dusterio / hlsinjector Goto Github PK
View Code? Open in Web Editor NEWID3 metadata injector for MPEG TS (HLS) written in PHP
ID3 metadata injector for MPEG TS (HLS) written in PHP
Hi there ! Thank you for this greate lib but I can't make it work...
I inject id3 into each .ts segments i have, at 0 seconds. ffprobe and mediastreamvalidator show me a timed id3 "track" but it's not triggered in my code.
# /root/bin/ffprobe tmpqzw34x62_hls_256/tmpqzw34x62_256.m3u8
Input #0, hls,applehttp, from 'tmpqzw34x62_hls_256/tmpqzw34x62_256.m3u8':
Duration: 00:04:40.66, start: 1.400000, bitrate: 0 kb/s
Program 0
Metadata:
variant_bitrate : 0
Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 255 kb/s
Stream #0:1: Data: timed_id3 (ID3 / 0x20334449)
Unsupported codec with id 1414087731 for input stream 1
I've tested my playing code with Apple stream samples and it triggers the timedmetadata notification well.
When injecting an ID3 file containing a TXXX frame, the start time is always 0. I would expect the start time to be equal to the number given in the macrofile( -e
).
php injector.php -i segment.ts -e macro.txt -m inject -o segment2.ts
macro.txt
2 id3 apple.id3
apple.id3
49443304 00000000 00145458 58580000 000A0000 0300776F 726B696E 6700
All files needed to reproduce:
issue.zip
Hi,
I'm not able to get around the actual format needed for -e option, Can you provide some sample file?
Hi dusterio, Are you planning to implement support for PAT frames without empty pointer field? The tool is not working for my mpeg-ts files generated by gstreamer. For my files ord($oneFrame[4]) = 166 at line 158. Thanks.
The moment
field in the metadata file is meant to be absolute pts_time in seconds, correct? (Not relative to the start time of the segment). So if I have a segment with a starting with PTS: 1000000 (timebase of 1/1000000, so 1 second), and inject a tag at 0 seconds, I shouldn't expect any tags to be injected, since that time lies outside the segment?
Also, does this injector parse the timebase, or assume some fixed number? (I'm having some odd results with segments encoded using different timebases.)
First thank you for posting this with the generous licensing terms. That said I just recently updated to PHP 8.2 and it quit working, but does not throw any errors either. Normally the exec_output array looks like this:
(
[0] => ** Imported 1 metadata tags
[1] => Parsed 1551 MPEG TS frames with 0 errors
[2] => Total of 1 programs and 2 streams
[3] => Injected 0 frames
[4] => Finished in 4.734ms
)
But now it only outputs:
(
[0] => ** Imported 1 metadata tags
)
I'll be happy to offer a modest bounty to get this working again under PHP 8.2. There is so much low level bit twiddling going on in the code I don't feel like doing this myself unless I absolutely have too. If it comes to that I will make a pull request.
Thanks.
This does what ffmpeg cannot. Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.