Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working? #1

Open
dehy opened this issue Jan 23, 2016 · 15 comments
Open

Not working? #1

dehy opened this issue Jan 23, 2016 · 15 comments

Comments

@dehy
Copy link

dehy commented Jan 23, 2016

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.

@dusterio
Copy link
Owner

Hi @dehy!

That's strange – this tool is being used on a daily basis on one of my projects.

I noticed that your ffprobe is complaining about stream 1, not stream 0 (where ID3 is). What do you have on stream1? Can you do ffmpeg -i on your source file, before metadata injection?

@pcouture
Copy link

Having issues as well. Looks like everything is working but the id3 tags aren't being thrown by Flash or an HTML5 player. The third stream 'timed_id3' gets added after I use your program. It's also on a working segment that is throwing the event right.

Input #0, mpegts, from 'fubo-test-000.ts':
Duration: 00:00:10.44, start: 1.400000, bitrate: 959 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x360, 24 fps, 24 tbr, 90k tbn, 48 tbc
Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 146 kb/s
Stream #0:2[0x102]: Data: timed_id3 (ID3 / 0x20334449)`

@dusterio
Copy link
Owner

@pcouture what Flash player do you use? I've personally tested this (and using on a daily basis) with flashls and iOS native video player. As for the native HTML5 streaming in browsers - I'm not sure if any browser supports metadata yet (when I developed this, I had no choice but to use a Flash player)

@pcouture
Copy link

Hey Dusterio,

Thank you for responding. I'm using JWPlayer to try to get the cues because I have it working using Wowza but now I'm trying to do a Kurento RTP stream to ffmpeg HLS output, then I use your script to encode the ID3's. I'm not 100% if I'm encoding the stream right. It plays fine in JWPlayer, HLS.js but not VLC or Safari. Not very senior with ffmpeg.

Do you have any experience with a ffmpeg hls stream with this? I've pasted the encoder settings below if so.

p.s. I've been going through forums all week and its like I"m following your trail a year ago. Flashhls is the one that stands out lol.

Cheers,
Peter

                    var command = ffmpeg({ logger: console.log() }) //, { timeout: 432000 }
                    .addOption('-probesize', 2147483647)
                    .addOption('-analyzeduration', 2147483647)
                    .addOption('-i', 'public/sdps/video-audio3.sdp')
                    .addOption('-ss', 2)
                    .addOption('-async', 1)
                    .addOption('-acodec', 'aac')
                    .addOption('-ac', 2)
                    .addOption('-r', 25)
                    .addOption('-vcodec', 'libx264')
                    .addOption('-vprofile', 'baseline')
                    .addOption('-force_key_frames', '2')
                    //.addOption('-preset', 'superfast')
                    //.addOption('-tune', 'zerolatency')
                    .addOption('-x264opts', 'level=31')
                    .addOption('-s', '640x360')
                    .addOption('-f', 'segment')
                    .addOption('-segment_time', 10)
                    .addOption('-segment_list_flags', '+live')
                    .addOption('-segment_list', streamPath + '/test.m3u8')
                    .addOption('-segment_list_entry_prefix', 'https://45.55.45.79:8443/stream/')
                    .addOption('-segment_format', 'mpegts')

@umair-sabir
Copy link

Hey Hi,

But how are you inserting the ID# tags in video. Using what command

On Fri, Mar 25, 2016 at 10:27 AM, Peter Couture [email protected]
wrote:

Hey Dusterio,

Thank you for responding. I'm using JWPlayer to try to get the cues
because I have it working using Wowza but now I'm trying to do a Kurento
RTP stream to ffmpeg HLS output, then I use your script to encode the
ID3's. I'm not 100% if I'm encoding the stream right. It plays fine in
JWPlayer, HLS.js but not VLC or Safari. Not very senior with ffmpeg.

Do you have any experience with a ffmpeg hls stream with this? I've pasted
the encoder settings below if so.

p.s. I've been going through forums all week and its like I"m following
your trail a year ago. Flashhls is the one that stands out lol.

Cheers,
Peter

                var command = ffmpeg({ logger: console.log() }) //, { timeout: 432000 }
                .addOption('-probesize', 2147483647)
                .addOption('-analyzeduration', 2147483647)
                .addOption('-i', 'public/sdps/video-audio3.sdp')
                .addOption('-ss', 2)
                .addOption('-async', 1)
                .addOption('-acodec', 'aac')
                .addOption('-ac', 2)
                .addOption('-r', 25)
                .addOption('-vcodec', 'libx264')
                .addOption('-vprofile', 'baseline')
                .addOption('-force_key_frames', '2')
                //.addOption('-preset', 'superfast')
                //.addOption('-tune', 'zerolatency')
                .addOption('-x264opts', 'level=31')
                .addOption('-s', '640x360')
                .addOption('-f', 'segment')
                .addOption('-segment_time', 10)
                .addOption('-segment_list_flags', '+live')
                .addOption('-segment_list', streamPath + '/test.m3u8')
                .addOption('-segment_list_entry_prefix', 'https://45.55.45.79:8443/stream/')
                .addOption('-segment_format', 'mpegts')


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#1 (comment)

@nareshv
Copy link

nareshv commented May 15, 2016

After running this tool on a segment, Getting this error https://github.com/bjarnoldus/momovi-video-hls/blob/master/flash/src/org/mangui/HLS/muxing/PES.as#L66 in flashhls based webplayers

This is the exact error "PES start code not found or not AAC/AVC: 269"

This is the before output from ffmpeg

    Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 158 kb/s

and after output from ffmpeg

    Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 158 kb/s
    Stream #0:2[0x102]: Data: timed_id3 (ID3  / 0x20334449)
Unsupported codec with id 1414087731 for input stream 2

@dusterio
Copy link
Owner

Hmm, I'm not 100% sure but it looks like that player only allows video or audio streams - no metadata streams. See lines 64 and 65.

I'm personally using this one: https://github.com/mangui/flashls, as well as native iOS player - both play my videos with ID3 metadata just fine.

I'm concerned about your ffmpeg output though - I will check further about it. ffmpeg shouldn't give any warnings

@nareshv
Copy link

nareshv commented May 15, 2016

@dusterio The above coderef i have shared is for the flashls only. The above problem is reproduced on flashls build mangui-flashls-df5b9f3

Here is what i am using for id3 injection.

Metadata file contents

1 plaintext TESTING

Script output

** Imported 1 metadata tags
Inserting ID3 frame after frame 3074 (len=188)
Parsed 11276 MPEG TS frames with 0 errors
Total of 1 programs and 2 streams
Injected 1 frames
Finished in 91.257ms

Once above tag is injected into a .ts file, flashls just stalls. (I can play the id3 injected video in mplayer though). In order to test the metadata presence i am using flashls. So far did not had any luck with both (your code & flashls). Not sure which one to check.

I just had one question. Is the time thats specified in the metadata file, relative to the current segment or relative to the entire stream ?. An example in your README should help !

@dusterio
Copy link
Owner

Relative to the segment file you are passing! I, for instance, cut the video in 10 second segments and always inject at 0 seconds - so each of segments has a text in the beginning

@nareshv
Copy link

nareshv commented May 15, 2016

@dusterio Thank You. I have tried id3 metadata instead of plaintext and updated to latest flashls from git instead of http://www.flashls.org .Now i can see the id3 tags in the logs of the flashls player and player stalls doesn't happen anymore.

@dusterio
Copy link
Owner

@nareshv good to know! I'm surprised that flashls.org still contains links to the old version, they fixed this a year ago!

@nareshv
Copy link

nareshv commented May 16, 2016

One new thing. I am not able to inject the metadata into a segment thats generated using ffmpeg command. Could you help me with this ?

Generate dummy video with ffmpeg

ffmpeg -hide_banner -v warning -y -f lavfi -i smptebars \
-t 5 \
-f lavfi -i anullsrc=r=44100:cl=stereo -c:a aac -strict experimental \
-movflags +faststart  \
-c:v libx264 -profile:v baseline -pix_fmt yuv420p -bsf:v h264_mp4toannexb \
-t 5 \
-f mpegts /tmp/out.ts

ffprobe -hide_banner /tmp/out.ts
Input #0, mpegts, from '/tmp/out.ts':
  Duration: 00:00:05.02, start: 1.400000, bitrate: 50 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 4 kb/s

Inject the timing

php ./hlsinjector/injector.php -i /tmp/out.ts -m inject -e /tmp/timing.txt -o /tmp/new.ts

** Imported 1 metadata tags
Parsed 167 MPEG TS frames with 0 errors
Total of 1 programs and 2 streams
Injected 0 frames   <--------------- Not injected
Finished in 1.394ms

Output of new file from ffmpeg (no id3 tag inserted, but the new stream 0:2 is visible)

ffprobe -hide_banner /tmp/new.ts
[NULL @ 0xa9dbe0] start time for stream 2 is not set in estimate_timings_from_pts
Input #0, mpegts, from '/tmp/new.ts':
  Duration: 00:00:05.02, start: 1.400000, bitrate: 50 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 4 kb/s
    Stream #0:2[0x102]: Data: timed_id3 (ID3  / 0x20334449)
Unsupported codec with id 1414087731 for input stream 2

ffmpeg version is 2.8

@byrion
Copy link

byrion commented Aug 24, 2017

I'm seeing the same problem mentioned above where metadata is not being injected into .ts files created with FFMPEG.

It looks as though this might be because no PTS (presentation timestamps) are being discovered. Any idea why this might be? Is this because FFMPEG is not inserting the optional PES header?

https://github.com/dusterio/hlsinjector/blob/master/injector.php#L231
https://github.com/dusterio/hlsinjector/blob/master/injector.php#L913

@BoydRotgans
Copy link

I'm seeing the same problem mentioned above where metadata is not being injected into .ts files created with FFMPEG.

It looks as though this might be because no PTS (presentation timestamps) are being discovered. Any idea why this might be? Is this because FFMPEG is not inserting the optional PES header?

https://github.com/dusterio/hlsinjector/blob/master/injector.php#L231
https://github.com/dusterio/hlsinjector/blob/master/injector.php#L913

Dear @byrion, it has been some time. but where you able to solve this?

@JungleGenius
Copy link

@BoydRotgans , @byrion ,

This will code will work with ffmpeg versions up to ffmpeg-4.2.2

https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-4.2.2-amd64-static.tar.xz

Versions higher that this fail. If someone could isolate the ffmpeg pull request that broke this code it could be updated to work with newer versions of ffmpeg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants