Skip to content

Conversation

@grazzolini
Copy link

I have revamped the record option and I also put in a check for its usage with -O so it doesn't break it. Basically you can't mix both.

@grazzolini grazzolini changed the title Record Add a Record option May 15, 2017
@codecov
Copy link

codecov bot commented May 15, 2017

Codecov Report

Merging #920 into master will increase coverage by <.01%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master     #920      +/-   ##
==========================================
+ Coverage   51.27%   51.28%   +<.01%     
==========================================
  Files         234      234              
  Lines       14271    14284      +13     
==========================================
+ Hits         7318     7326       +8     
- Misses       6953     6958       +5

@gravyboat
Copy link
Member

@grazzolini Sorry for the delay on getting to this. I'm fine with this enhancement, @beardypig, @bastimeyer any concerns?

"-R", "--record",
action="store_true",
help="""
When using -o, enable recording the stream while also playing it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide a command line example of using this in the help section?

Copy link
Member

@bastimeyer bastimeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should call the parameter --record (also why capitalizing the -R param?)... This may be confusing, because the actual "recording" parameter is -o (or -O) and this new parameter is just there for also using the player or passthrough output in addition to the -o parameter.

What about tests? Adding new parameters without tests is usually not a good thing to do.

I also agree with @gravyboat that we need a better documentation of the parameter with an example. Command line examples need to be indented by two spaces.

@grazzolini
Copy link
Author

grazzolini commented May 28, 2017

@bastimeyer
I don't have any issues in renaming the option to something else. "recording" is just in the sense you're recording something live or something like that. Having said that, I'm out of ideas on what to call it.

I use this option for recording some live events I want to review later. As for an example, I can write one, but --record only works with -o, so it would need to be there in the example. Regarding tests, I think I can write those as well, no problem. Let us just settle on a name for the option.

@bastimeyer
Copy link
Member

@grazzolini
Yeah, it's not easy finding a short and precise parameter name.

# output is a file (a simple "record" command)
streamlink -o file url quality
# output is stdout
streamlink -O url quality | tee file
# output is the player and a file (the name "record" doesn't make sense here unfortunately)
streamlink -o file --record url quality

If the implementation was like this, the name "record" could be kept:

# output is the player and a file (watch and record at the same time)
streamlink --record file url quality
streamlink -r file url quality

I think this is a better idea and much easier to understand by the end user. But how should streamlink behave in this case if both -o and -r are being used at the same time?

@grazzolini
Copy link
Author

@bastimeyer
How about make the usage of both at the same time impossible, like what I did with -O? This would surely make the record option more palatable and easier to understand.

There's a reason why I prefer the recording to be done at streamlink itself. tee buffers it's input and that cause buffering issues on the player. You can mess with the cache parameter, but even then there's some type of double buffering. And tee does not always respect stdbuf.

@bastimeyer
Copy link
Member

make the usage of both at the same time impossible

Yes, this is ok.

There's a reason why I prefer the recording to be done at streamlink itself.

I've just listed the -o and -O parameters as an example to make the parameter naming scheme more visible. I was not arguing that tee is a better way of recording streams.

Regarding the shorthand parameter name, it should be -r, so that it's clear that it's a replacement of the -o parameter ("record-and-play"). -R could be added as an equivalent to the -O param in the sense of "pipe-and-play".

@gravyboat
Copy link
Member

Can we implement the changes requested by @bastimeyer? I would like to get this merged.

@grazzolini
Copy link
Author

@gravyboat
I think I should be able to hack something tomorrow. It makes sense to add both -r and -R options. I'll also try to write some tests for these as well.

@gravyboat
Copy link
Member

@grazzolini Sounds good, any other feedback @bastimeyer?

@back-to
Copy link
Collaborator

back-to commented Nov 22, 2017

  • if you use -R but not -o it will not record anything,
    there should be a error- or infomessage
    that -o is missing or/and no download started

  • if -R and -o is set there should be an infomessage that the download started,

    if you use -o without -R there will be
    [download][123.ts] Written 4.8 MB (14s @ 330.3 KB/s

    but with -R you won't know if it started
    there is only a debug message, but you don't use it normally
    [cli][debug] Writing stream to output


Not important but this can confuse people who don't know how hls streams work

  • if you record a vod and close it, the output file will be ahead of the player time.
    on twitch ~40sec
  • if you record a livestream and close it, the output file will be ahead of the player time.
    on twitch ~10sec

@bastimeyer
Copy link
Member

grazzolini wants to merge 97 commits into streamlink:master from grazzolini:record
Commits 97
Files changed 144
+2,303 -1,257

You need to properly rebase your branch in order to fix this PR. This is impossible to review on Github in the current state and I don't want to diff your branch locally and comment here then...

# set up proper remote repos
git remote add upstream https://github.com/streamlink/streamlink.git
git remote add github https://github.com/grazzolini/streamlink.git

# I guess your local branch is called record, too
git checkout record

# fix the local master branch, just in case
git fetch upstream
git branch --force master upstream/master

# fix the local record branch and only pick the necessary commits
git rebase --interactive master

# force push in order to upgrade the PR
git push --force github record

@grazzolini
Copy link
Author

@bastimeyer

I have rebased the record branch according to streamlink master. I have been, in the past few months, replacing these files after I update streamlink, so I can continue to use this option. I had not time to write proper tests for it, but it would be great to add them.

@gravyboat
Copy link
Member

@bastimeyer Any further thoughts on this one?

@bastimeyer
Copy link
Member

No further thoughts, as the points from all my previous comments still stand...
The comment from Feb 8th was about the messed up branch and not related to the actual changes of this PR.

@beardypig
Copy link
Member

@grazzolini you still interested in getting this merged in? 👍

@grazzolini
Copy link
Author

Hi @beardypig, given that I have been manually patching files for adding this, yes, I am. I have started writing some tests a couple of months ago, but there were some new streamlink versions in the meantime, so I ended up no updating things.

qkolj added a commit to qkolj/streamlink that referenced this pull request Nov 4, 2018
 - Remove `-r` as short option for `--rtmp-rtmpdump`

 - Add options `--record` (`-r`) and `--record-and-pipe` (`-R`) as suggested by @bastimeyer in discussion on streamlink#920

 - Add info message that the download started as suggested by @back-to in discussion on streamlink#920

 - Add tests for `streamlink_cli.main.create_output` where these arguments are used
Add a record option for recording a stream while also playing it.
@gravyboat
Copy link
Member

@grazzolini Looks like you did a push on this a couple days ago. Are you still working on it?

@grazzolini
Copy link
Author

@gravyboat, I occasionally do a rebase from master to keep this branch passing all the checks. I did make some changes to this branch though, because there were changes, specially to argparser.py. But I didn't introduce anything new.

gravyboat pushed a commit that referenced this pull request Jan 4, 2019
* Add a record option

Add a record option for recording a stream while also playing it.

* Fix recording added in #920 by @grazzolini

 - Remove `-r` as short option for `--rtmp-rtmpdump`

 - Add options `--record` (`-r`) and `--record-and-pipe` (`-R`) as suggested by @bastimeyer in discussion on #920

 - Add info message that the download started as suggested by @back-to in discussion on #920

 - Add tests for `streamlink_cli.main.create_output` where these arguments are used
@back-to
Copy link
Collaborator

back-to commented Jan 11, 2019

Added in #2152

@back-to back-to closed this Jan 11, 2019
jackyzy823 pushed a commit to jackyzy823/streamlink that referenced this pull request Mar 20, 2019
* Add a record option

Add a record option for recording a stream while also playing it.

* Fix recording added in streamlink#920 by @grazzolini

 - Remove `-r` as short option for `--rtmp-rtmpdump`

 - Add options `--record` (`-r`) and `--record-and-pipe` (`-R`) as suggested by @bastimeyer in discussion on streamlink#920

 - Add info message that the download started as suggested by @back-to in discussion on streamlink#920

 - Add tests for `streamlink_cli.main.create_output` where these arguments are used
Billy2011 pushed a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2020
* Add a record option

Add a record option for recording a stream while also playing it.

* Fix recording added in streamlink#920 by @grazzolini

 - Remove `-r` as short option for `--rtmp-rtmpdump`

 - Add options `--record` (`-r`) and `--record-and-pipe` (`-R`) as suggested by @bastimeyer in discussion on streamlink#920

 - Add info message that the download started as suggested by @back-to in discussion on streamlink#920

 - Add tests for `streamlink_cli.main.create_output` where these arguments are used
mkbloke pushed a commit to mkbloke/streamlink that referenced this pull request Aug 18, 2020
* Add a record option

Add a record option for recording a stream while also playing it.

* Fix recording added in streamlink#920 by @grazzolini

 - Remove `-r` as short option for `--rtmp-rtmpdump`

 - Add options `--record` (`-r`) and `--record-and-pipe` (`-R`) as suggested by @bastimeyer in discussion on streamlink#920

 - Add info message that the download started as suggested by @back-to in discussion on streamlink#920

 - Add tests for `streamlink_cli.main.create_output` where these arguments are used
resiproxy pushed a commit to resiproxy/streamlink that referenced this pull request Nov 5, 2020
* Add a record option

Add a record option for recording a stream while also playing it.

* Fix recording added in streamlink#920 by @grazzolini

 - Remove `-r` as short option for `--rtmp-rtmpdump`

 - Add options `--record` (`-r`) and `--record-and-pipe` (`-R`) as suggested by @bastimeyer in discussion on streamlink#920

 - Add info message that the download started as suggested by @back-to in discussion on streamlink#920

 - Add tests for `streamlink_cli.main.create_output` where these arguments are used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants