NapoleonWils0n / kodi-playercorefactory

kodi playercorefactory.xml players to play and record videos and bash scripts
GNU General Public License v3.0
80 stars 69 forks source link

FOX Newsrecording errors #4

Closed hejazb closed 8 years ago

hejazb commented 8 years ago

Hi Dear: Napoleon I just gave up on recording from Android TV box (Beelink I68) because I lack Linux coding and expertise. But, now I am having problem FOX NEWS when using the “Y” key to play and record. It starts to work but it suddenly quits. I will attach the text of Videourl.txt and the error I get using command line “bash rip-record videourl.txt”. My device is laptop Win10Pro 64bit with 8 gig RAM. Thank you so much for the help and wish a happy holiday

BBC America Video URL text that plays and records. http://31.220.40.117:80/LiveEdge/BBCAmericaHD/chunklist_w1501351379_b1000000.m3u8?token=2427b69e291e20dafd3e6a95f8559678 Fox News Video Url that does not work. http://foxnews-f.akamaihd.net/i/BrightCove/694940094001/2015/12/20/694940094001_466921,7038001_4669207233001,7007001_4669207233001,7022001_4669207233001,6490001_4669207233001,7067001_4669207233001,.mp4.csmil/master.m3u8 “”Recording errors before updating windows scripts today”” C:\Users\Boby\Desktop>bash rip-record videourl.txt Input #0, hls,applehttp, from 'http://foxnews-f.akamaihd.net/i/BrightCove/694940094001/2015/12/20/694940094001_466921,7038001_4669207233001,7007001_4669207233001,7022001_4669207233001,6490001_4669207233001,7067001_4669207233001,.mp4.csmil/master.m3u8 ': Duration: 00:04:17.67, start: 0.100511, bitrate: 0 kb/s Program 0 Metadata: variant_bitrate : 145000 Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 15 fps, 15 tbr, 90k tbn, 30 tbc Metadata: variant_bitrate : 145000 Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 54 kb/s Metadata: variant_bitrate : 145000 Program 1 Metadata: variant_bitrate : 312000 Stream #0:2: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 476x268 [SAR 1072:1071 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Metadata: variant_bitrate : 312000 Stream #0:3: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 63 kb/s Metadata: variant_bitrate : 312000 Program 2 Metadata: variant_bitrate : 488000 Stream #0:4: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Metadata: variant_bitrate : 488000 Stream #0:5: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 63 kb/s Metadata: variant_bitrate : 488000 Program 3 Metadata: variant_bitrate : 890000 Stream #0:6: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Metadata: variant_bitrate : 890000 Stream #0:7: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 63 kb/s Metadata: variant_bitrate : 890000 Program 4 Metadata: variant_bitrate : 1335000 Stream #0:8: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Metadata: variant_bitrate : 1335000 Stream #0:9: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 63 kb/s Metadata: variant_bitrate : 1335000 Program 5 Metadata: variant_bitrate : 58000 Stream #0:10: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 65 kb/s Metadata: variant_bitrate : 58000 [matroska @ 000002a05f5947c0] Codec for stream 0 does not use global headers but container format requires global headers [matroska @ 000002a05f5947c0] Codec for stream 1 does not use global headers but container format requires global headers [matroska @ 000002a05f5947c0] Error parsing AAC extradata, unable to determine samplerate. Output #0, matroska, to 'C:\Users\Boby/Desktop/video.mkv': Metadata: encoder : Lavf57.19.100 Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 1k tbn, 90k tbc Metadata: variant_bitrate : 488000 Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, 54 kb/s Metadata: variant_bitrate : 145000 Stream mapping: Stream #0:4 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument.

“”Recording errors after updating windows scripts today FOX NEWS videourl.txt”” C:\Users\Boby\Desktop>bash rip-record videourl.txt [h264 @ 0000028e6c7cd500] non-existing SPS 0 referenced in buffering period Last message repeated 1 times [h264 @ 0000028e6c7b8420] non-existing SPS 0 referenced in buffering period Last message repeated 1 times [h264 @ 0000028e6d3012e0] non-existing SPS 0 referenced in buffering period Last message repeated 1 times [h264 @ 0000028e6d589b80] non-existing SPS 0 referenced in buffering period Last message repeated 1 times [h264 @ 0000028e6c7b3e20] non-existing SPS 0 referenced in buffering period Last message repeated 1 times [h264 @ 0000028e6c7b4740] non-existing SPS 0 referenced in buffering period Last message repeated 1 times [h264 @ 0000028e6d327c60] non-existing SPS 0 referenced in buffering period [h264 @ 0000028e6d2a5940] non-existing SPS 0 referenced in buffering period [h264 @ 0000028e6d3084e0] non-existing SPS 0 referenced in buffering period [h264 @ 0000028e6c7b5060] non-existing SPS 0 referenced in buffering period [h264 @ 0000028e6c7b5e20] non-existing SPS 0 referenced in buffering period [h264 @ 0000028e6d35e080] non-existing SPS 0 referenced in buffering period Input #0, hls,applehttp, from 'http://foxnews-f.akamaihd.net/i/2015/12/24/PKG0243-122315TSAPKG-5L0FKTGA_FNC_,XLOW,LOW,MED_LOW,MED,HIGH,HD,.mp4.csmil/master.m3u8': Duration: 00:02:43.73, start: 0.100511, bitrate: 0 kb/s Program 0 Metadata: variant_bitrate : 170000 Stream #0:0: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 320x180 [SAR 45:45 DAR 16:9], 15 fps, 15 tbr, 90k tbn, 30 tbc Metadata: variant_bitrate : 170000 Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 62 kb/s Metadata: variant_bitrate : 170000 Program 1 Metadata: variant_bitrate : 359000 Stream #0:2: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 480x268 [SAR 134:135 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Metadata: variant_bitrate : 359000 Stream #0:3: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 66 kb/s Metadata: variant_bitrate : 359000 Program 2 Metadata: variant_bitrate : 559000 Stream #0:4: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 640x360 [SAR 90:90 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Metadata: variant_bitrate : 559000 Stream #0:5: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 66 kb/s Metadata: variant_bitrate : 559000 Program 3 Metadata: variant_bitrate : 1059000 Stream #0:6: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 640x360 [SAR 90:90 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Metadata: variant_bitrate : 1059000 Stream #0:7: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 66 kb/s Metadata: variant_bitrate : 1059000 Program 4 Metadata: variant_bitrate : 1559000 Stream #0:8: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 640x360 [SAR 90:90 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Metadata: variant_bitrate : 1559000 Stream #0:9: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 66 kb/s Metadata: variant_bitrate : 1559000 Program 5 Metadata: variant_bitrate : 2558000 Stream #0:10: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 1280x720 [SAR 180:180 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Metadata: variant_bitrate : 2558000 Stream #0:11: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 66 kb/s Metadata: variant_bitrate : 2558000 Program 6 Metadata: variant_bitrate : 61000 Stream #0:12: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 66 kb/s Metadata: variant_bitrate : 61000 [matroska @ 0000028e6fb39020] Codec for stream 0 does not use global headers but container format requires global headers [matroska @ 0000028e6fb39020] Codec for stream 1 does not use global headers but container format requires global headers [matroska @ 0000028e6fb39020] Error parsing AAC extradata, unable to determine samplerate. Output #0, matroska, to 'C:\Users\Boby/Desktop/video.mkv': Metadata: encoder : Lavf57.19.100 Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1280x720 [SAR 180:180 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 1k tbn, 90k tbc Metadata: variant_bitrate : 2558000 Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, 62 kb/s Metadata: variant_bitrate : 170000 Stream mapping: Stream #0:10 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

NapoleonWils0n commented 8 years ago

Hi hejazb

i have fixed the fox link The problem was it had a comma in the url, i have added the comma to the m3u8 regular expression in the video-regex.sh file on linux, mac osx and windows.

If you do a git pull you will get the fix I recorded the clip on the command line, it seems to be a 5 minute clip and not a live stream Not sure which addon in Kodi the link is from so i havent been able to do a test recording from within kodi, but if it works on the command line it record from kodi as well

Let me know if the fix works for you, if not could you tell me which addon the stream is from in kodi and ill try and figure out what the issue is

I would also recommend the Phoenix addon and UKTV Now if you dont have them

Happy christmas mate

hejazb commented 8 years ago

Hi Dear: Napoleon

You are a genius, it is fixed and it is working like charm. Thank you and wish you a nice happy holiday with all the joys. I have a request, I like to PM you, how can I do that? It is about recording from the following link in Kodi. http://www.iranntv.com/?p=281476 which is a human rights issue. Thank you in advance

NapoleonWils0n commented 8 years ago

Hi Hejazb

I have got a way for you to record the video stream from iranntv.com What we are going to do open the developer tools in the browser and monitor the network requests when the video is playing which will show you the location of m3u8 file

1 - Open the http://www.iranntv.com/?p=281476 page in your browser

2 - open the developer tools on firefox and chrome

firefox to open the developer tools on firefox press: ctrl + shift + c

chrome to open the developer tools on chrome press: ctrl + shift + i

3 - select the Network tab in the devolper tools

firefox: select the network tab, you may have to click enable network logging or something then reload the webpage by pressing ctrl r , then click the play button on the video look in the network tab and you will see a link that looks like this playlist.m3u8?token=Fddsys right click on the playlist.m3u8?token=Fddsys link and select Copy URL that copies the link to your clipboard, create a new text document and paste in the link and save the file as iranntv.txt

chrome: select the network tab and then click the circle icon on the second row, or press ctrl e then reload the webpage by pressing ctrl r , then click the play button on the video look in the network tab and you will see a link that looks like this playlist.m3u8?token=Fddsys right click on the playlist.m3u8?token=Fddsys link and select Copy URL that copies the link to your clipboard, create a new text document and paste in the link and save the file as iranntv.txt to your desktop

4 - record the video on the command line you can record the video on the command line and specify a duration for the recording , but i havent managed to get the recording to work from within kodi

open the terminal and change to the desktop: cd Desktop

to record the video without specifying a duration: bash rip-record iranntv.txt

to record the video with a duration: the syntax is: -t 00:00:00 in hours, minutes, seconds

record for 30 minutes: bash rip-record iranntv.txt -t 00:30:00

record for 1 hour: bash rip-record iranntv.txt -t 01:00:00

record for 2 hours: bash rip-record iranntv.txt -t 02:00:00

The url will look like this: http://ngx.cr1.streamzilla.xlcdn.com/session/f75100676eafc93b91ddb976ef8c8b96/sz/simay/wowza4/live/MultiL.smil/playlist.m3u8?token=3C473tO2BZA4iBgBCfn4PQ&time=1451079737

Notice the ?token=3C473tO2BZA4iBgBCfn4PQ&time=1451079737 at the end of the url.

The m3u8 has a token and time in the url, once you have the link you can play with kodi, my rip-play script on the command line or other players like vlc or mpv

You can play the link, if you want to record the video you will need to start recording within 1 or 2 hours of getting the link otherwise the time and token variables in the url will have changed

5 - adding the video link to kodi, so you can play the video in Kodi instead of the browser

strm files copy the link from inside the iranntv.txt file and paste it into a new file and save it as iranntv.strm move the iranntv.strm file to folder you can access from kodi, eg in kodi go to videos, files and select Add videos then browse to a folder on your hard drive and select it, but dont set the content type to tv or movies just leave it blank then you can browse to that folder in kodi and select the iranntv.txt file and it will play

playlist for playlist loader copy the text below into a text file and name it iranntv.plx

version=1 background=https://upload.wikimedia.org/wikipedia/commons/thumb/c/ca/Flag_of_Iran.svg/2000px-Flag_of_Iran.svg.png title=iranntv # type=video name=Iranntv thumb=https://upload.wikimedia.org/wikipedia/commons/thumb/c/ca/Flag_of_Iran.svg/2000px-Flag_of_Iran.svg.png URL=add-url-here #

You need to replace add-url-here with the url from the iranntv.txt file Move the iranntv.txt file to a folder on your hard drive Open playlist loader in kodi and select: Add a new list give the list a name like: Iranntv then select: New local-list Browse to the folder you save the iranntv.plx file and then select the file and click ok You can now play the video from within kodi

6 - cant record video from within kodi, but you can record on the command line The m3u8 has several different streams from low to high quality and i havent been able to get the recording to work from within kodi, but you can record on the command line i updated the video-regex.sh file to catch the m3u8 token time url

You will need to get the video link from the web page to get the latest link, i have found the url expires after about 2 hours, but you can leave the video playing and it wont stop after 2 hours, but you will need to start the recording soon within 1 to 2 hours of getting the link from the web page

7 - getting the video link from iranntv with python it is possible to use python to get the video link from a webpage there is some example code on stackoverflow http://stackoverflow.com/questions/28726616/python-trouble-getting-embedded-video-url

but i havent managed to getting it working with iranntv

if you google for kodi iranntv there seem to be a couple of iranian iptv addons Iran tv iptv, Iran Live Tv, Persian Live TV

i dont know if any of those addons has anything from iranntv.com otherwise you will need to get the link for the video manually using the developer tools

8 - recording the best quality stream you can find the best quality stream from the m3u8 file and record that link if you open the terminal and type: bash rip-stats iranntv.txt

it will create a text file called video-stats.txt on your desktop the contents will look like this

program|stream|index=0|codec_name=timed_id3|profile=unknown|codec_type=data|bit_rate=N/A stream|index=1|codec_name=h264|profile=Main|codec_type=video|width=720|height=404|bit_rate=N/A stream|index=2|codec_name=aac|profile=LC|codec_type=audio|bit_rate=66.750000 Kbit/s

program|stream|index=3|codec_name=timed_id3|profile=unknown|codec_type=data|bit_rate=N/A stream|index=4|codec_name=h264|profile=High|codec_type=video|width=720|height=404|bit_rate=N/A stream|index=5|codec_name=aac|profile=LC|codec_type=audio|bit_rate=60.375000 Kbit/s

program|stream|index=6|codec_name=timed_id3|profile=unknown|codec_type=data|bit_rate=N/A stream|index=7|codec_name=h264|profile=High|codec_type=video|width=720|height=404|bit_rate=N/A stream|index=8|codec_name=aac|profile=LC|codec_type=audio|bit_rate=63 Kbit/s

stream|index=0|codec_name=timed_id3|profile=unknown|codec_type=data|bit_rate=N/A stream|index=1|codec_name=h264|profile=Main|codec_type=video|width=720|height=404|bit_rate=N/A stream|index=2|codec_name=aac|profile=LC|codec_type=audio|bit_rate=66.750000 Kbit/s stream|index=3|codec_name=timed_id3|profile=unknown|codec_type=data|bit_rate=N/A stream|index=4|codec_name=h264|profile=High|codec_type=video|width=720|height=404|bit_rate=N/A stream|index=5|codec_name=aac|profile=LC|codec_type=audio|bit_rate=60.375000 Kbit/s stream|index=6|codec_name=timed_id3|profile=unknown|codec_type=data|bit_rate=N/A stream|index=7|codec_name=h264|profile=High|codec_type=video|width=720|height=404|bit_rate=N/A stream|index=8|codec_name=aac|profile=LC|codec_type=audio|bit_rate=63 Kbit/s format|duration=N/A|size=N/A

There are 9 streams, starting at 0 ending at 8, means 9 links There are actually 3 different quality version for the video stream you only want the audio and video streams not the streams that say codec_name=timed_id3

If you look at the video-stats file the video codec has a profile which indicates the quality level

stream|index=1|codec_name=h264|profile=Main|codec_type=video|width=720|height=404|bit_rate=N/A stream|index=4|codec_name=h264|profile=High|codec_type=video|width=720|height=404|bit_rate=N/A stream|index=7|codec_name=h264|profile=High|codec_type=video|width=720|height=404|bit_rate=N/A

The stream index=1 video codec is h264 main profile the h264 main profile isnt the highest quality and is mainly used for small mobile device like phones

Stream index 4 and 7 are using the h264 high profile

You can select which stream index to record with ffmpeg by using the -map option to specify which audio and video streams to record

So in this case we want to record stream index 7 for the h264 high profile video and stream index 8 for the best quality aac audio

stream|index=7|codec_name=h264|profile=High|codec_type=video|width=720|height=404|bit_rate=N/A stream|index=8|codec_name=aac|profile=LC|codec_type=audio|bit_rate=63 Kbit/s

Heres the command you use in the terminal to record stream index 7 for the video, and stream index 8 for the audio using the map option in ffmpeg

notes replace video-url-goes-here with the actual url between the single quotes change 00:30:00 to the recording duration you want, or remove -t 00:30:00 from the command and press ctrl c to quit the recording

ffmpeg -hide_banner -loglevel panic -i 'video-url-goes-here' \ -map 0:7 -bsf:v mpeg4_unpack_bframes \ -map 0:8 -bsf:a aac_adtstoasc -t 00:30:00 \ "$USERPROFILE/Desktop/iranntv.mkv"

Hope that helps

NapoleonWils0n commented 8 years ago

Hi Mate ill close this issue and ill look at how to record iranntv from within kodi