To-Slalom

mpv

Jun 30th, 2021 (edited)
654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.13 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #################################################
  4. #                                               #
  5. # Basic script to play stream videos and audios #
  6. # using mpv if present                          #
  7. #                                               #
  8. # https://pastebin.com/raw/fSwhuPyx             #
  9. #################################################
  10. # mpv: symbol lookup error: /usr/lib/libsmbconf.so.0: undefined symbol: nt_time_to_full_timespec, version SAMBA_UTIL_0.0.1
  11.  
  12. # mpv 0.32.0 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
  13. # built on UNKNOWN
  14. # ffmpeg library versions:
  15. #   libavutil       56.31.100
  16. #   libavcodec      58.54.100
  17. #   libavformat     58.29.100
  18. #   libswscale      5.5.100
  19. #   libavfilter     7.57.100
  20. #   libswresample   3.5.100
  21. # ffmpeg version: 4.2.2-1ubuntu1
  22.  
  23.  
  24.  
  25. ###############################################################
  26. # lets define basic variables to do the rest of the nasty job #
  27. ###############################################################
  28. APP="mpv"
  29. UA="User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0"
  30. # https://forum.puppylinux.com/viewtopic.php?f=160&t=1523&sid=c85ab12e383da8cf8606f3e4d4434e5c
  31. # https://forum.endeavouros.com/t/use-mpv-for-video-on-urls/10316
  32. ######################################################
  33. # lets check if we have the app(s) install in our OS #
  34. ######################################################
  35. list=( $APP )
  36. for i in "${list[@]}" ; do
  37.     if ! command -v $i &> /dev/null ; then
  38.         echo "$i isnt install yet"
  39.         exit
  40.     fi
  41. done
  42.  
  43. # audio files
  44. # ogg , mp3 , flac , m3u
  45. URL="https://archive.org/download/1968-electric-ladyland/1968-electric-ladyland_vbr.m3u"
  46. URL="https://ia801207.us.archive.org/35/items/Akala-The_War_Mixtape_Vol.2_Deluxe_Edition-Bootleg-2CD-2008-RAGEMP3/101-akala-welcome_back_to_england.ogg"
  47. URL="https://ia801207.us.archive.org/35/items/Akala-The_War_Mixtape_Vol.2_Deluxe_Edition-Bootleg-2CD-2008-RAGEMP3/105-akala-heaterz_%28freestyle%29.mp3"
  48. URL="https://ia903403.us.archive.org/11/items/1968-electric-ladyland/02%20-%20Have%20You%20Ever%20Been%20%28To%20Electric%20Ladyland%29.flac"
  49. # ogv , mp4 , mkv
  50. URL="https://ia800408.us.archive.org/33/items/CastingCrowns-NightOfJoy2014/CastingCrowns-NightOfJoy2014.ogv"
  51. URL="https://archive.org/download/disorder_in_the_court/disorder_in_the_court.mp4"
  52. URL="https://archive.org/download/CastingCrowns-NightOfJoy2014/CastingCrowns-NightOfJoy2014.mkv"
  53. # youtube
  54. URL="https://www.youtube.com/watch?v=j6yppO90X3g"
  55. # Stream url
  56. URL="https://streaming-live.rtp.pt/liverepeater/smil:rtpn.smil/rtp_playlist.m3u8?token=1625198400_12685bd9e5e3adcc27128238375edce05ba07efa"
  57. ##################################################
  58. # lets set optins if youtube or strem or default #
  59. ##################################################
  60. if [[ $URL =~ "youtube" ]] ; then
  61.     command="--hwdec-codecs=all"
  62. elif [[ $URL =~ "m3u8" ]] ; then
  63.     command="--http-header-fields=\"${UA}\""
  64. else
  65.     command=""
  66. fi
  67. ################################
  68. # lunch app with right options #
  69. ################################
  70. echo mpv ${command} "${URL}"
  71. mpv ${command} "${URL}"
  72.  
  73.  
Add Comment
Please, Sign In to add comment