paljsingh / impartus-downloader

Download Impartus lectures, convert to mkv for offline viewing.
GNU General Public License v3.0
23 stars 8 forks source link

[Bug]: video size is 1Kb - empty video #70

Closed MayuraVerma closed 3 years ago

MayuraVerma commented 3 years ago

Describe the bug If the track is more than 1, then the video is empty, 1KB

To Reproduce download any video with track more than 1, check the video size

Expected behavior Video is expected to be full

Screenshots

image

image

Desktop (please complete the following information):

paljsingh commented 3 years ago

Thanks for reporting the issue.. Can you please provide the json info for this lecture, I've sent a mail to you regarding how to get it from firefox / chrome.

paljsingh commented 3 years ago

Hi Mayura,

Thanks for reporting the issue. My initial guess is that this could be due to track 1 not having any video, and everything being dumped in track 2. In all the 140+ lectures I've access to, I've only seen impartus videos with track 1 having content of all the tracks (and that's the assumption the app is working on).

Can you provide me the json data for one of the lectures, impartus api does not have any authentication checks on the m3u8 content, so I should be able to download and debug the issue with the lecture data alone.

(attaching a screenshot to illustrate how to get it from firefox/chrome)

1) Open Web developer tools (chrome) View -> Developer -> Developer Tools (firefox) Tools -> Browser Tools -> Web Developer Tools

2) Go to Network tab

3) visit impartus site and click on the lecture you are having issue downloading.

4) Search in the filters box for 'api/lectures'

5) click on the request ending with 'info'

6) Go to Response tab

7) Copy the json response and send it to me. IN firefox you may need to click 'Raw' json button to see the json data.

On Sun, Jun 27, 2021 at 11:16 AM ಮಯೂರ ವರ್ಮ @.***> wrote:

Assigned #70 https://github.com/paljsingh/impartus-downloader/issues/70 to @paljsingh https://github.com/paljsingh.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/paljsingh/impartus-downloader/issues/70#event-4943573935, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJONKY3HSSAJDXBQS5R2B3TU23LXANCNFSM47MB3XJA .

paljsingh commented 3 years ago

Not sure if github email sends the image attachments, so adding the screenshot here too -

Screenshot 2021-06-27 at 12 51 34 PM
MayuraVerma commented 3 years ago

Hello Jitender,

Thanks for responding so quickly.

I may be doing something wrong. Please check

This is without filter [image: image.png] with filter [image: image.png]

On Sun, Jun 27, 2021 at 12:39 AM Jitender Singh @.***> wrote:

Not sure if github email sends the image, attachments, so adding the screenshot here too -

[image: Screenshot 2021-06-27 at 12 51 34 PM] https://user-images.githubusercontent.com/5433003/123536599-ea182480-d748-11eb-819d-c36ff5b64b44.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paljsingh/impartus-downloader/issues/70#issuecomment-869117220, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLJIAKTQ5FDJW3CMSISCFTTU3IU7ANCNFSM47MB3XJA .

paljsingh commented 3 years ago

you may need to post the image directly to github, looks like sending it via email strips out the attachments.

MayuraVerma commented 3 years ago

{"duration":758.923,"position":1925.74,"viewNum":0,"speed":1,"bitRate":821897,"url2":" https://b.impartus.com/download1/vc_recordings/5824460/master.m3u8","url":" https://a.impartus.com/ilc/#/video/id/3689700"}

On Sun, Jun 27, 2021 at 1:05 AM Jitender Singh @.***> wrote:

you may need to post the image directly to github, looks like sending it via email strips out the attachments.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paljsingh/impartus-downloader/issues/70#issuecomment-869120109, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLJIAPZYPWLBTMQQLJYN5DTU3LUZANCNFSM47MB3XJA .

MayuraVerma commented 3 years ago

I think the previous reply may have answered your question

This is without filter in Chrome image

This is with filter in Chrome image

MayuraVerma commented 3 years ago

this is with "api" as filter in firefox

{"duration":758.923,"position":1925.74,"viewNum":0,"speed":1,"bitRate":821897,"url2":"https://b.impartus.com/download1/vc_recordings/5824460/master.m3u8","url":"https://a.impartus.com/ilc/#/video/id/3689700"}

image

paljsingh commented 3 years ago

Thanks, I think that should be good enough.. though for whatever reason it didn't send the lecture info request, this one too has the m3u8 url and ttid.

paljsingh commented 3 years ago

I am able to download and process the video without any issues - My guess is it could be a throttling issue on your end, multi track videos are rather large, this one downloads 250+ mb of stream data, and final video being 190mb in size.

By any chance if you are downloading 2 or more such videos in parallel, impartus site is going to throttle the connection, you should see error logs on console if that is the case.

Can you try deleting the video and re-downloading it, and see if that solves the issue. Another thing you can do is: set the debug flag to True in imaprtus.conf , restart app, download the video, and check the stream files that are created under a folder structure like:

/var/folders/sh/some-random-id/T/impartus.media/5824460 You should be able to see both track-0.ts and track-1.ts (track-0.ts has both video and audio, track-1.ts has no video, only audio)

ls -l should show the size like 170mb and 120 mb for the two.

try dragging and dropping the files to vlc and you can confirm if the files show up some video and audio...

Screenshot 2021-06-27 at 2 32 01 PM
paljsingh commented 3 years ago

Describe the bug If the track is more than 1, then the video is empty, 1KB

To Reproduce download any video with track more than 1, check the video size

Expected behavior Video is expected to be full

Screenshots

image

image

Desktop (please complete the following information):

  • OS: mac os 10.15.7
  • Python Version 3.9.0

Though, another issue, I see here (in the 2nd screenshot) is not filtering ':' character in the filepath. Historically, OSX used ':' as path separator, and Finder app still treats it as '/' thereby showing the file name as Introduction-From-35/00-2021-05-15.mkv instead of Introduction-From-35:00-2021-05-15.mkv

Harmless though since, accessing the file using either cli / ui works and the system handles the ':' -> '/' mapping internally. Still a little discrepancy in the display (especially with Finder.app) ref: https://apple.stackexchange.com/questions/173529/when-did-the-colon-character-become-an-allowed-character-in-the-filesystem

I'll log a bug and fix this soon.

paljsingh commented 3 years ago

@MayuraVerma Were you able to resolve the issue? or any debug logs that can provide info on the issue you are facing?

MayuraVerma commented 3 years ago

@paljsingh Still no luck. I tried few times with only one download at a time. Its a while to download, meaning it's downloading something in background. At the end, I get only an empty video with 1KB.

I tried with debug flag true, I didn't get any additional files than the mkv and a text file

paljsingh commented 3 years ago

Can you paste the output of the following:

ffmpeg -version


After setting the flag: debug: True in etc/impartus.conf, restart application and download a multi-track file (preferably the one you mentioned in the earlier post, Video Lecture # 03 , Topic: Data Analytics Contd. by Ramakrishna Dantu so that the id in the following commands works as is)

After download is completed/fails, try the following commands:

find /var/folders/sh/ -type d -name 5824460 2>/dev/null | xargs ls -l

md5 $(find /var/folders/sh/ -type d -name 5824460 2>/dev/null)/*


Also, any output seen on console (including the logs printed by ffmpeg)

In case you are free today or tomorrow, let's set up a quick 15-20 min call on hangout to sort this out.

MayuraVerma commented 3 years ago

ffmpeg version 3.0.1 Copyright (c) 2000-2016 the FFmpeg developers built with Apple LLVM version 7.3.0 (clang-703.0.29) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-vda libavutil 55. 17.103 / 55. 17.103 libavcodec 57. 24.102 / 57. 24.102 libavformat 57. 25.100 / 57. 25.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 31.100 / 6. 31.100 libavresample 3. 0. 0 / 3. 0. 0 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100

MayuraVerma commented 3 years ago

In case you are free today or tomorrow, let's set up a quick 15-20 min call on hangout to sort this out.

Please send me an email to mayura.verma@gmail.com

MayuraVerma commented 3 years ago

Now I have updated ffmpeg to latest version. I downloaded the file.

I am able to download the full video.

Thank you very much. Your code works like a charm.

(You may to add requirement for ffmpeg version.)

ffmpeg version 4.4-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2000-2021 the FFmpeg developers built with Apple clang version 11.0.0 (clang-1100.0.33.17) configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100

MayuraVerma commented 3 years ago

I am able to download the full video.

Thank you for the support.