K-S-V / Scripts

Collection of my scripts
GNU General Public License v3.0
635 stars 226 forks source link

AdobeHDS.php fails to download live stream #23

Closed xwin closed 10 years ago

xwin commented 10 years ago

AdobeHDS.php fails to download live stream using following command line: $ php AdobeHDS.php --manifest "http://50.7.136.42:9821/stream/FFA0945BCCDF67161820222426283048/f.f4m" --delete --debug --duration 60 --debug command is optional but --duration is needed as the stream is live

The website in question is http://www.ontvtime.ru/general/tvc.html The script detects discontinuity for every other segment and due to this drops a lot of segments. It also only creates one file and records everything in it so it appears to detect only one segment of fails to switch between them. After download time expires the script does not find any segments in the stream.

xwin commented 10 years ago

After monitoring traffic generated by the page embedded player I can see that the player is downloading every other segment. I can see this in firefox network tool. Only segments with odd numbers are downloaded. Script appears to do the same thing but saving segments all in one file. I also found that any program from the archive which is not live also has the same issue. So the issue is not only with the live stream but in general with this site.

xwin commented 10 years ago

I found that PTS values in the stream are not written correctly after the first segment. This goes for both video and audio. In the first 8 seconds distance between consecutive frames is 0.04 seconds which make the video 25fps. After that the difference between consecutive frames is 0.12 seconds which is way too large for any frame rate. This makes video stutter and for audio vlc inserts silence between the frames. Not sure how to fix this yet.

xwin commented 10 years ago

The latest fix resolves the issue with timestamps.

K-S-V commented 10 years ago

Discontinuity in fragment numbering doesn't mean there is any discontinuity in final stream. it's handled properly by script. There was a bug in handling the timestamps after detection of timestamp gap. i have fixed it in fda6bbd47e10993234845cc40a36d0b875e1ccb0. also fragments are not saved locally in case of live streams. this is intentional behavior not a bug.

xwin commented 10 years ago

You are absolutely right. Discontinuity is not a problem. The "found 0 segments" message confused me. Because the stream is live, the script writes out segments into a file as it receives them so there are no segments, I understood that after studying the script. Maybe "found 0 segments" message should not be printed when the stream is live?