chrippa / livestreamer

Command-line utility that extracts streams from various services and pipes them into a video player of choice. No longer maintained, use streamlink or youtube-dl instead.
http://livestreamer.io/
BSD 2-Clause "Simplified" License
3.88k stars 582 forks source link

Ustream Videos keep Breaking and missing parts when downloading #1054

Open poochiteap opened 9 years ago

poochiteap commented 9 years ago

First and foremost I have to openly appreciate this software... It's awesome!

Now the issue I have is when I try to download this ustream link or any other ustream link using livestreamer -v -o out.flv http://www.ustream.tv/channel/20271235 best the video breaks missing some parts of the video every less than 10 secs. Even if I choose low clarity version it does the same. I tried the iphone link and it works smoothly but I cant get good clarity output of 720. livestreamer hlsvariant://http://iphone-streaming.ustream.tv/uhls/20271235/streams/live/iphone/playlist.m3u8 best -v -o new.flv -O --retry-streams 1 --retry-open 86400 Is there any way out?

Also if I can have another help, if a .m3u8 link that I am downloading ends streaming and restarts in some time, is there a way to download it to a single file (using :start & goto start, splits onto different files)

Thanks.

ghost commented 9 years ago

This is a known issue and we've already talked about it here: #860 In the end @jthall did come up with a working solution. Try it again with the modified plugin and tell us if it works for you.

jthall commented 9 years ago

Are you wanting the content to write to a single file even if the stream ends and then restarts?

You might be able to use a shell script and use vlc to output .ts format to a file, that way you don't have to deal with flv headers in the middle of your file. If you use () in your script, you can put the livestreamer command in a loop that behaves, like sleeps between attempts to get an offline stream.

poochiteap commented 9 years ago

@0880 @jthall Thanks for your replies. @0880 I checked the link that you provided. Thanks for the Link and I am checking how the output comes in various videos which I will post in 1-2 days time and close out this post. Nonetheless in random checking there seems to be many warnings coming in between like the 404 Not found and Failed to get module info / timeout and read timeout ending stream and the video seems working fine with some few minutes missing but let me check the videos which i really want and I will discuss.

@jthall. Thanks for the suggestion. Regarding the second question as getting the stream as a single file - the problem is the stream sometimes ends due to network issues and reconnects again. For this all that I found was to use start and goto start command which did help but I have to deal with files the number of times it disconnected and restarted streams (sometimes 6-7 files).

If you have time can you please help recode my command prompt that which I wrote which is - :start for /f "tokens=1-6 delims=/:." %%a in ("%date%.%time%") do set FileName=Out - %%a-%%b-%%c - %%d-%%e-%%f.flv" livestreamer http://www.ustream.tv/channel/20271235 best -v -o %FileName% -O --retry-streams 1 --retry-open 86400 goto start -- to include changes so that I can get my Live ustream downloading solid & complete and in one file preferable as a .mp4? Sorry to ask because I dont understand much coding and technical words used. If you can, please help.

Thanks

jthall commented 9 years ago

Hi,

I'm not familiar with this command syntax. oh wait a minute this :start is a label. I understand now.

I must admit I'm not familiar with the variable substitution used. Are you trying to archive this stream on a daily basis, play it with a flash player, or something else?

The simplest solution here might be to use ffmpeg to read the flash content on stdin and then output with -f mpegts -v copy so it doesn't try to transcode anything, then write the output to a file. You could, for example, do something like this. This example isn't for what you want, this example pulls the audio, deletes the silence, and then encodes it at mono 48khz. There's probably a better way to do it than this, but it works. You basically run this command and use >> to write the mp3 to a file. The gist here is the stuffin () gets executed as a single shot and the lame process stays open because stdout of the parent never closes due to the while loop never exits. The lame process then takes raw audio on its stdin and encodes it.

!/bin/sh

( while [ 1 ] do livestreamer -O --stream-segment-threads 6 http://www.ustream.tv/channel/live-iss-stream 240p,240+,240p+_alt_akamai,mobile_284p| mplayer - -novideo -really-quiet -nocache -ao pcm:nowaveheader:file=/dev/stdout | ecasound -q -f:f32_le,2,48000 -i stdin -R -enm:0.15,2000,60,5,60 -ge:0.15,0.01,1,-1 -f:s16_le,2,48000 -erc:1,2 -o stdout sleep 5 done ) | lame -s 48 -r -h -a -b 80 - -

On 9/3/15, poochiteap notifications@github.com wrote:

@0880 @jthall Thanks for your replies. @0880 I checked the link that you provided. Thanks for the Link and I am checking how the output comes in various videos which I will post in 1-2 days time and close out this post. Nonetheless in random checking there seems to be many warnings coming in between like the 404 Not found and Failed to get module info / timeout and read timeout ending stream but the video seems working fine till that point but let me check the videos which i really want and I will discuss.

@jthall. Thanks for the suggestion. Regarding the second question as getting the stream as a single file - the problem is the stream sometimes ends due to network issues and reconnects again. For this all that I found was to use start and goto start command which did help but I have to deal with files the number of times it disconnected and restarted streams (sometimes 6-7 files).

If you have time can you please help recode my command prompt that which I wrote which is - :start for /f "tokens=1-6 delims=/:." %%a in ("%date%.%time%") do set FileName=Out

  • %%a-%%b-%%c - %%d-%%e-%%f.flv" livestreamer http://www.ustream.tv/channel/20271235 best -v -o %FileName% -O --retry-streams 1 --retry-open 86400 goto start -- to include changes so that I can get my Live ustream downloading solid & complete and in one file preferable as a .mp4? Sorry to ask because I dont understand much coding and technical words used. If you can, please help.

Thanks


Reply to this email directly or view it on GitHub: https://github.com/chrippa/livestreamer/issues/1054#issuecomment-137597317

poochiteap commented 9 years ago

Thank you @jthall for your reply. Ignore my making of the code it is just made to the best that suit my needs without any technical knowledge. I try to download a stream which is live for 2hrs. I may start the record and I may leave cause I would be busy with other work. When I come back I just look to have the 2hr downloaded as a single video file that I can watch in any player as this is not archived by them for me to watch later. Actually i exaclty dont know whether retry part of the code serves any purpose for me just put them there as i copied it off the internet which is for 24 hrs... but I close it when i come back knowing their stream is over. All I tried to do in the code is:

  1. Keep connecting even if their stream stop as there might be network issues for them
  2. When the file is downloaded it comes with the time stamp
  3. I trying to have the video to continue in the same output file even if their stream stops in between.

Regarding ustream issue i figured that even tho i have 8mbps conncection, 720p doesnt download full since it says not found or time out/ 480 hangs after some time and only responds if i press enter... only worst (240) works good.

jthall commented 9 years ago

well, if you use the word best, then it will try the best quality stream. To install my plugin, simply check it out with git and follow the installation instructions for installing from git. On my computer I just type python setup.py install and it installs away.

I like the idea of timestamps in the filename. That's pretty cool.

On 9/3/15, poochiteap notifications@github.com wrote:

Thank you @jthall for your reply. Ignore my making of the code it is just made to the best that suit my needs without any technical knowledge. I try to download a stream which is live for 2hrs. I may start the record and I may leave cause I would be busy with other work. When I come back I just look to have the 2hr downloaded as a single video file that I can watch in any player as this is not archived by them for me to watch later. Actually i exaclty dont know whether retry part of the code serves any purpose for me just put them there as i copied it off the internet which is for 24 hrs... but I close it when i come back knowing their stream is over. All I tried to do in the code is:

  1. Keep connecting even if their stream stop as there might be network issues for them
  2. When the file is downloaded it comes with the time stamp
  3. I trying to have the video to continue in the same output file even if their stream stops in between.

Regarding ustream issue i figured that even tho i have 8mbps conncection, 720p doesnt download full since it says not found or time out... only worst (240) works good.


Reply to this email directly or view it on GitHub: https://github.com/chrippa/livestreamer/issues/1054#issuecomment-137612519

poochiteap commented 9 years ago

@jthall Thanks for the updates in ustream plugin. I checked the download and for 2 hr video there is a missing of less than 50sec when the video quality is around 500. I dont know why but it doesnt seem to work when it is 720p and there tends to be loss in video tho I have a 10mbps connection without any background load!However it serves the purpose that I need it now for.

But getting the live streaming into a single file is still I am trying a solution. i have been trying the same for a rtmp download but yet it splits to a number of files according to disconnections.