LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   LinuxQuestions.org Member Success Stories (https://www.linuxquestions.org/questions/linuxquestions-org-member-success-stories-23/)
-   -   Using ffmpeg as a work-around for youtube-dl, especially on raiplay.it site (https://www.linuxquestions.org/questions/linuxquestions-org-member-success-stories-23/using-ffmpeg-as-a-work-around-for-youtube-dl-especially-on-raiplay-it-site-4175665106/)

donatom 11-28-2019 03:50 PM

Using ffmpeg as a work-around for youtube-dl, especially on raiplay.it site
 
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.

ondoho 11-29-2019 01:13 PM

Great you got it working with ffmpeg.

However, I wonder what version of youtube-dl you are using?
according to version 2019.11.28, RaiPlay is supported:
Code:

youtube-dl --list-extractors |grep -i raiplay
RaiPlay
RaiPlayLive
RaiPlayPlaylist


donatom 11-29-2019 01:31 PM

Quote:

Originally Posted by ondoho (Post 6063127)
Great you got it working with ffmpeg.

However, I wonder what version of youtube-dl you are using?
according to version 2019.11.28, RaiPlay is supported:
Code:

youtube-dl --list-extractors |grep -i raiplay
RaiPlay
RaiPlayLive
RaiPlayPlaylist


Thanks, ondoho. I just updated youtube-dl to 2018.11.28 via pip. I still get the error:
Code:

$ youtube-dl https://www.raiplay.it/video/2015/09/Non-uccidere-S1E1-8c6cc315-82f3-4677-b68a-07d84d6a84c9.html
[RaiPlay] 8c6cc315-82f3-4677-b68a-07d84d6a84c9: Downloading video JSON
ERROR: 8c6cc315-82f3-4677-b68a-07d84d6a84c9: Failed to parse JSON  (caused by ValueError('No JSON object could be decoded',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

One raiplay.it/youtube-dl user sent in a bug-report to yt-dl.org/bug and I also chimed in. It has been a month and nothing has changed. So . . .

ondoho 11-30-2019 01:31 AM

I cannot access that video even with my browser, always get a login popup.
Am I missing something here?

donatom 11-30-2019 09:52 AM

Quote:

Originally Posted by ondoho (Post 6063263)
I cannot access that video even with my browser, always get a login popup.
Am I missing something here?

You must sign up in order to watch these movies ("Registratti") and then you must sign on ("Accedi"). The process is free of charge. In order to do this, click on the three lines in the upper right-hand corner on the raiplay.it web-page.

In order to view some videos you have to be (or appear to be) in Italy. I use unlocator.com in order to use the site. Some VPNs will work as well.

Sometimes Firefox doesn't work, so I then try Chrome which seems to always work.


All times are GMT -5. The time now is 04:58 AM.