For the past 2 years I have used youtube-dl to capture streamed video from German sites (ARD.de, ZDF.de) and raiplay.it (an Italian site with many archived videos) with great success. However, recently this open-source software does not work with raiplay.it. When capturing is attempted there is invariable an error thrown ("Failed to parse JSON").
This error has been reported at yt-dl.org but so far nothing has been done to fix the problem. I have therefore started using ffmpeg as a work-around:
Here is the command to capture streams in the mp4 format (such files can be used for plexmediaserver):
Code:
ffmpeg -f pulse -ac 2 -i default -f x11grab -video_size 1154x686 -i :0.0+0,156 -acodec aac -vcodec libx264 -preset ultrafast -threads 2 -framerate 30 -y -t 01:40:00 Lea.mp4
There are three places where you will have to change the command for your own capturing. First the video_size will have to be modified, as well as information after "-i". "154" represents how far down from top of the desktop the streaming starts. To get this info, I open another instance of firefox and shrink the window to fit in the area of the stream; then I use the command "xwininfo" and click on the firefox window which is covering the stream. Here is how the print-out of the xwininfo command looks:
Code:
xwininfo: Window id: 0x2400003 "rasperry pi - Google Search - Mozilla Firefox"
Absolute upper-left X: 5
Absolute upper-left Y: 155
Relative upper-left X: 5
Relative upper-left Y: 29
Width: 1154
Height: 686
Depth: 24
Visual: 0xca
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x2400002 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +5+155 -121+155 -121-183 +5-183
-geometry 1154x686+0+126
Note: in the event that xwininfo gives you odd numbers, you must convert them into even numbers (subtract 1 from them); otherwise ffmpeg will throw an error. You can see that I changed “Absolute upper-left Y” from 155 to 154.
Modify the length of the stream after -t (my stream was 1 hour, 40 minutes) to correspond to your own stream. Ffmpeg will then stop capturing the stream after the amount of time indicated.
Unfortunately (unlike youtube-dl) you will not be able to use your computer until after the capture is complete.