hls from php curl ignores duration
AnsweredI've built a small php app to extract chunks of video for easy downloading by law enforcement.
Select the start time, stop time & camera name, and a file is extracted for easy access on a plain text web page.
The extract works fine using wget. Version 1.19 or later required for digest auth.
wget --no-check-certificate --output-document=video1.mkv --http-user=admin --http-password=somepass https://demo.networkoptix.com:7001/hls/f03d3ac6-4abc-6d9c-257a-a6c704b6b20f.mkv?pos="2018-10-18T10:10:00.000"&duration=120
However when I run the same url from php curl, the duration is ignored, and stream goes on and on.
$url = "https://demo.networkoptix.com:7001/hls/" . $row['camera_uuid'] . ".mkv?pos=\"" . $row['start'] . ":00.000\"&duration=" . $duration;
$ch = curl_init($url);
// lots of other curl options set
// resultant url line
// https://demo.networkoptix.com:7001/hls/f03d3ac6-4abc-6d9c-257a-a6c704b6b20f.mkv?pos="2018-10-10T10:07:00.000"&duration=60
Any suggestions?
-
Hello David,
1) Date 2018-10-18T10:10:00.000 is in future in demo system timezone, so server returns live stream
2) Try the URL without quotes in it. For example http://demo.networkoptix.com:7001/hls/5d760b8f-a1d2-d393-8d9e-cf7935201de0.mkv?hi&pos=2018-10-15T10:10:00.000&duration=300
This link worked for me.
Hope this helps.
0 -
Also in web client interface, we have something similar:
You can open some camera http://demo.networkoptix.com:7001/static/index.html#/view/5d760b8f-a1d2-d393-8d9e-cf7935201de0
Then top right bottom of the camera view has 'gear' button which opens menu with 'Camera details' button.
If you click it - the dialog will show with the ability to download a part of the archive:
0 -
Nice, dropping the quotes fixed the issue, thank you.
Future was local time here in NZ, GMT+12, so ok against our local server, but nice potential bug catch!
Well made feature in the web interface. Will show it to users.
Thanks very much for prompt reply and very useful answers.
0
Please sign in to leave a comment.
Comments
3 comments