Skip to content

Conversation

@qkolj
Copy link
Contributor

@qkolj qkolj commented Nov 4, 2018

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 Add a Record option #920

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

  • Add tests for streamlink_cli.main.create_output where these arguments are used


Since original author abandoned his PR, and I think this is a really useful feature, I have gone ahead and changed their code to implement suggested changes and add necessary tests.

grazzolini and others added 4 commits August 3, 2018 00:16
Add a record option for recording a stream while also playing it.
 - 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
@qkolj qkolj changed the title Record fix Fix recording added in #920 Nov 4, 2018
@codecov
Copy link

codecov bot commented Nov 4, 2018

Codecov Report

Merging #2152 into master will increase coverage by 1.28%.
The diff coverage is 64.28%.

@@            Coverage Diff             @@
##           master    #2152      +/-   ##
==========================================
+ Coverage   51.36%   52.65%   +1.28%     
==========================================
  Files         234      237       +3     
  Lines       14236    14738     +502     
==========================================
+ Hits         7313     7760     +447     
- Misses       6923     6978      +55

@beardypig
Copy link
Member

As this is a breaking change (changing the function of -r) it would require a major release.

@karlo2105
Copy link

I don't see the advantage of adding this feature as recording can be made through -o switch.
If you want to play it and record simultaneously video, you can use SHIFT+r switch on VLC.

@grazzolini
Copy link

@karlo2105, this assumes using VLC. I have written this option directly into streamlink for several reasons, including being player agnostic. But also because when doing the recording through a pipe, I had run through some buffering issues were the recording would be ok, but the playback would suffer. I have been patching my local streamlink installation for some time now to add this functionality and I would continue to do so. But it would be good to have this added to streamlink directly.

Copy link
Collaborator

@back-to back-to left a comment

Choose a reason for hiding this comment

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

If you use the following command and close the player with X,
this will happen.

$ streamlink -R oo.ts https://www.twitch.tv/dreamhack -l info | mpv -
Playing: -

...

Traceback (most recent call last):
  File "/usr/lib/python3.7/logging/__init__.py", line 1038, in emit
    self.flush()
  File "/usr/lib/python3.7/logging/__init__.py", line 1018, in flush
    self.stream.flush()
BrokenPipeError: [Errno 32] Broken pipe
Call stack:
  File "venv/bin/streamlink", line 11, in <module>
    load_entry_point('streamlink', 'console_scripts', 'streamlink')()
  File "src/streamlink_cli/main.py", line 1040, in main
    log.info("Closing currently open stream...")
Message: 'Closing currently open stream...'
Arguments: ()
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

EDIT:

removed wall of text

@qkolj
Copy link
Contributor Author

qkolj commented Nov 30, 2018

Thanks for the review! I fixed the duplicate help string, but I am out of ideas how to expand them to include more details. If you, or anyone else has a better idea what to write there, please feel free to suggest.

Copy link
Collaborator

@back-to back-to left a comment

Choose a reason for hiding this comment

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

If you use the following command and close the player with X,
the error message is still not optimal.

$ streamlink https://www.youtube.com/watch?v=XSGBVzeBUbk 360p -R x.mp4 --force -l none | mpv -
Playing: -
[file] Reading from stdin...
 (+) Video --vid=1 (*) (h264 640x360 24.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 44100Hz)
AO: [pulse] 44100Hz stereo 2ch float
VO: [gpu] 640x360 yuv420p
AV: 00:00:01 / 00:09:56 (0%) A-V:  0.000 Cache: 205s+19MB


Exiting... (Quit)
error: Error when writing to output: [Errno 32] Broken pipe, exiting
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

@qkolj
Copy link
Contributor Author

qkolj commented Dec 11, 2018

This broken pipe error:

error: Error when writing to output: [Errno 32] Broken pipe, exiting
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

can be reproduced even with the existing -O command. For example:

$ streamlink -O https://www.twitch.tv/yogscast 360p | mpv -
Playing: -
[file] Reading from stdin...
 (+) Video --vid=1 (h264 640x360)
 (+) Audio --aid=1 (aac 2ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 640x360 yuv420p
AV: 00:00:00 / 00:00:11 (2%) A-V: -0.004 DS: 2.083/0 Cache: 11s+1MB


Exiting... (Quit)
error: Error when writing to output: [Errno 32] Broken pipe, exiting
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

I am not sure what's the best way to handle this. Closing stderr on SIGPIPE would certainly prevent the error message from showing up, but I am not sure if that would prevent some other useful output.

@back-to
Copy link
Collaborator

back-to commented Dec 12, 2018

can be reproduced even with the existing -O

as this is the same behavior, I think it can be ignored for now.


also there is a AttributeError, see my other comment

@gravyboat
Copy link
Member

Since we're doing a major release I'm going to merge this in.

@gravyboat gravyboat merged commit 07387e2 into streamlink:master Jan 4, 2019
@gravyboat gravyboat mentioned this pull request Jan 4, 2019
@bastimeyer
Copy link
Member

This merge has caused issues with the --player-continuous-http and --player-external-http parameters.

@back-to, since you reviewed the changes of this PR, could you please see if there are more regressions other than #2234 when you get the time? Thanks!

@back-to back-to mentioned this pull request 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
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Apr 1, 2020
streamlink 1.3.1 (2020-01-27)

A small patch release that addresses the removal of MPV's legacy option syntax, also with fixes of several plugins, the addition of the --twitch-disable-reruns parameter and dropped support for Python 3.4.

streamlink 1.3.0 (2019-11-22)

A new release with plugin updates and fixes, including Twitch.tv (see #2680), which had to be delayed due to back and forth API changes.

The Twitch.tv workarounds mentioned in #2680 don't have to be applied anymore, but authenticating via --twitch-oauth-token has been disabled, regardless of the origin of the OAuth token (via --twitch-oauth-authenticate or the Twitch website). In order to not introduce breaking changes, both parameters have been kept in this release and the user name will still be logged when using an OAuth token, but receiving item drops or accessing restricted streams is not possible anymore.

Plugins for the following sites have also been added:

    albavision
    news.now.com
    twitcasting.tv
    viu.tv
    vlive.tv
    willax.tv

streamlink 1.2.0 (2019-08-18)

Here are the changes for this month's release

    Multiple plugin fixes
    Fixed single hyphen params at the beginning of --player-args (#2333)
    --http-proxy will set the default value of --https-proxy to same as --http-proxy. (#2536)
    DASH Streams will handle headers correctly (#2545)
    the timestamp for FFMPEGMuxer streams will start with zero (#2559)

streamlink 1.1.1 (2019-04-02)

This is just a small patch release which fixes a build/deploy issue with the new special wheels for Windows on PyPI. (#2392)

streamlink 1.0.0 (2019-01-30)

The celebratory release of Streamlink 1.0.0!

A lot of hard work has gone into getting Streamlink to where it is. Not only is Streamlink used across multiple applications and platforms, but companies as well.

Streamlink started from the inaugural fork of Livestreamer on September 17th, 2016.

Since then, We've hit multiple milestones:

    Over 886 PRs
    Hit 3,000 commits in Streamlink
    Obtaining our first sponsors as well as backers of the project
    The creation of our own logo (streamlink/streamlink#1123)

Thanks to everyone who has contributed to Streamlink (and our backers)! Without you, we wouldn't be where we are today.

Without further ado, here are the changes in release 1.0.0:

    We have a new icon / logo for Streamlink! (streamlink/streamlink#2165)
    Updated dependencies (streamlink/streamlink#2230)
    A ton of plugin updates. Have a look at this search query for all the recent updates.
    You can now provide a custom key URI to override HLS streams (streamlink/streamlink#2139). For example: --hls-segment-key-uri <URI>
    User agents for API communication have been updated (streamlink/streamlink#2194)
    Special synonyms have been added to sort "best" and "worst" streams (streamlink/streamlink#2127). For example: streamlink --stream-sorting-excludes '>=480p' URL best,best-unfiltered
    Process output will no longer show if tty is unavailable (streamlink/streamlink#2090)
    We've removed BountySource in favour of our OpenCollective page. If you have any features you'd like to request, please open up an issue with the request and possibly consider backing us!
    Improved terminal progress display for wide characters (streamlink/streamlink#2032)
    Fixed a bug with dynamic playlists on playback (streamlink/streamlink#2096)
    Fixed makeinstaller.sh (streamlink/streamlink#2098)
    Old Livestreamer deprecations and API references were removed (streamlink/streamlink#1987)
    Dependencies have been updated for Python (streamlink/streamlink#1975)
    Newer and more common User-Agents are now used (streamlink/streamlink#1974)
    DASH stream bitrates now round-up to the nearest 10, 100, 1000, etc. (streamlink/streamlink#1995)
    Updated documentation on issue templates (streamlink/streamlink#1996)
    URL have been added for better processing of HTML tags (streamlink/streamlink#1675)
    Fixed sort and prog issue (streamlink/streamlink#1964)
    Reformatted issue templates (streamlink/streamlink#1966)
    Fixed crashing bug with player-continuous-http option (streamlink/streamlink#2234)
    Make sure all dev dependencies (streamlink/streamlink#2235)
    -r parameter has been replaced for --rtmp-rtmpdump (streamlink/streamlink#2152)

Breaking changes:

    A large number of unmaintained or NSFW plugins have been removed. You can find the PR that implemented that change here: streamlink/streamlink#2003 . See our CONTRIBUTING.md documentation for plugin policy.
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Apr 6, 2020
streamlink 1.3.1 (2020-01-27)

A small patch release that addresses the removal of MPV's legacy option syntax, also with fixes of several plugins, the addition of the --twitch-disable-reruns parameter and dropped support for Python 3.4.

streamlink 1.3.0 (2019-11-22)

A new release with plugin updates and fixes, including Twitch.tv (see #2680), which had to be delayed due to back and forth API changes.

The Twitch.tv workarounds mentioned in #2680 don't have to be applied anymore, but authenticating via --twitch-oauth-token has been disabled, regardless of the origin of the OAuth token (via --twitch-oauth-authenticate or the Twitch website). In order to not introduce breaking changes, both parameters have been kept in this release and the user name will still be logged when using an OAuth token, but receiving item drops or accessing restricted streams is not possible anymore.

Plugins for the following sites have also been added:

    albavision
    news.now.com
    twitcasting.tv
    viu.tv
    vlive.tv
    willax.tv

streamlink 1.2.0 (2019-08-18)

Here are the changes for this month's release

    Multiple plugin fixes
    Fixed single hyphen params at the beginning of --player-args (#2333)
    --http-proxy will set the default value of --https-proxy to same as --http-proxy. (#2536)
    DASH Streams will handle headers correctly (#2545)
    the timestamp for FFMPEGMuxer streams will start with zero (#2559)

streamlink 1.1.1 (2019-04-02)

This is just a small patch release which fixes a build/deploy issue with the new special wheels for Windows on PyPI. (#2392)

streamlink 1.0.0 (2019-01-30)

The celebratory release of Streamlink 1.0.0!

A lot of hard work has gone into getting Streamlink to where it is. Not only is Streamlink used across multiple applications and platforms, but companies as well.

Streamlink started from the inaugural fork of Livestreamer on September 17th, 2016.

Since then, We've hit multiple milestones:

    Over 886 PRs
    Hit 3,000 commits in Streamlink
    Obtaining our first sponsors as well as backers of the project
    The creation of our own logo (streamlink/streamlink#1123)

Thanks to everyone who has contributed to Streamlink (and our backers)! Without you, we wouldn't be where we are today.

Without further ado, here are the changes in release 1.0.0:

    We have a new icon / logo for Streamlink! (streamlink/streamlink#2165)
    Updated dependencies (streamlink/streamlink#2230)
    A ton of plugin updates. Have a look at this search query for all the recent updates.
    You can now provide a custom key URI to override HLS streams (streamlink/streamlink#2139). For example: --hls-segment-key-uri <URI>
    User agents for API communication have been updated (streamlink/streamlink#2194)
    Special synonyms have been added to sort "best" and "worst" streams (streamlink/streamlink#2127). For example: streamlink --stream-sorting-excludes '>=480p' URL best,best-unfiltered
    Process output will no longer show if tty is unavailable (streamlink/streamlink#2090)
    We've removed BountySource in favour of our OpenCollective page. If you have any features you'd like to request, please open up an issue with the request and possibly consider backing us!
    Improved terminal progress display for wide characters (streamlink/streamlink#2032)
    Fixed a bug with dynamic playlists on playback (streamlink/streamlink#2096)
    Fixed makeinstaller.sh (streamlink/streamlink#2098)
    Old Livestreamer deprecations and API references were removed (streamlink/streamlink#1987)
    Dependencies have been updated for Python (streamlink/streamlink#1975)
    Newer and more common User-Agents are now used (streamlink/streamlink#1974)
    DASH stream bitrates now round-up to the nearest 10, 100, 1000, etc. (streamlink/streamlink#1995)
    Updated documentation on issue templates (streamlink/streamlink#1996)
    URL have been added for better processing of HTML tags (streamlink/streamlink#1675)
    Fixed sort and prog issue (streamlink/streamlink#1964)
    Reformatted issue templates (streamlink/streamlink#1966)
    Fixed crashing bug with player-continuous-http option (streamlink/streamlink#2234)
    Make sure all dev dependencies (streamlink/streamlink#2235)
    -r parameter has been replaced for --rtmp-rtmpdump (streamlink/streamlink#2152)

Breaking changes:

    A large number of unmaintained or NSFW plugins have been removed. You can find the PR that implemented that change here: streamlink/streamlink#2003 . See our CONTRIBUTING.md documentation for plugin policy.
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.

7 participants