-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add a Record option #920
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
Add a Record option #920
Conversation
Codecov Report
@@ 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 |
|
@grazzolini Sorry for the delay on getting to this. I'm fine with this enhancement, @beardypig, @bastimeyer any concerns? |
src/streamlink_cli/argparser.py
Outdated
| "-R", "--record", | ||
| action="store_true", | ||
| help=""" | ||
| When using -o, enable recording the stream while also playing it. |
There was a problem hiding this comment.
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?
bastimeyer
left a comment
There was a problem hiding this 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.
|
@bastimeyer 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. |
|
@grazzolini # 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 qualityIf 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 qualityI 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? |
|
@bastimeyer 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. |
Yes, this is ok.
I've just listed the Regarding the shorthand parameter name, it should be |
|
Can we implement the changes requested by @bastimeyer? I would like to get this merged. |
|
@gravyboat |
|
@grazzolini Sounds good, any other feedback @bastimeyer? |
Not important but this can confuse people who don't know how hls streams work
|
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 |
|
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. |
|
@bastimeyer Any further thoughts on this one? |
|
No further thoughts, as the points from all my previous comments still stand... |
|
@grazzolini you still interested in getting this merged in? 👍 |
|
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. |
- 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.
|
@grazzolini Looks like you did a push on this a couple days ago. Are you still working on it? |
|
@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. |
* 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
|
Added in #2152 |
* 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
* 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
* 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
* 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
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.