warren-bank / node-hls-downloader-tubitv

Command-line utility for downloading an offline copy of TubiTV HLS video streams.
GNU General Public License v2.0
58 stars 8 forks source link

ffmpeg failure #9

Closed f1vefour closed 9 months ago

f1vefour commented 9 months ago

I'm getting this error after a download completes.

download complete.

starting ffmpeg conversion of HLS stream to mp4 file..
ffmpeg error:
Error: ffmpeg error: media file not found
    at /usr/local/lib/node_modules/@warren-bank/node-hls-downloader-tubitv/lib/fallback.js:35:14
    at new Promise (<anonymous>)
    at run_fallback_ffmpeg_video_conversion (/usr/local/lib/node_modules/@warren-bank/node-hls-downloader-tubitv/lib/fallback.js:12:10)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async process_html (/usr/local/lib/node_modules/@warren-bank/node-hls-downloader-tubitv/lib/process_cli.js:105:9)
    at async process_url (/usr/local/lib/node_modules/@warren-bank/node-hls-downloader-tubitv/lib/process_cli.js:67:5)
    at async process_argv (/usr/local/lib/node_modules/@warren-bank/node-hls-downloader-tubitv/lib/process_cli.js:379:7)

ffmpeg (v4.4.2) is in my path and working

warren-bank commented 9 months ago

yeah.. these comments in an older issue explain the problem:

  1. byte ranges, rather than video segments
  2. ffmpeg workaround
  3. v1.5.4

in short, strictly speaking, tubitv isn't hosting HLS video any longer.. and ffmpeg doesn't like it when HLS manifests only contain a single media segment

warren-bank commented 9 months ago

quick test:

  tubidl --version

  # 1.5.4
  set tmpdir="e:\.workspace"
  mkdir %tmpdir%
  cd /D %tmpdir%

  tubidl -q -mc 5 -u "https://tubitv.com/tv-shows/381933/s01-e01-in-the-wild"

  # starting download of 1 video data files..
  # done
  # 
  # starting download of 1 audio data files..
  # done
  # 
  # download complete.
  # 
  # starting ffmpeg conversion of HLS stream to mp4 file..
  # ffmpeg error:
  # starting fallback ffmpeg conversion to mp4 file..
  # done
  ffplay "Mr. Bean The Animated Series/S01E01 - In the Wild/mp4/video.mp4"

conclusions:

warren-bank commented 9 months ago

actually.. taking a closer look at your error message.. it seems that:

question:

f1vefour commented 9 months ago
rooted@odroid:~$ exa --tree Doomsday\ Brothers/         Doomsday Brothers
└── S01E01 - Daughter of Humunga
   ├── hls
   │  ├── audio
   │  │  ├── english
   │  │  │  └── segment_0.aac
   │  │  ├── english - audio description
   │  │  │  └── segment_0.aac
   │  │  ├── english - audio description.m3u8
   │  │  └── english.m3u8
   │  ├── master.m3u8
   │  ├── video
   │  │  └── segment_0.ts
   │  └── video.m3u8
   └── mp4
      └── video.english.srt
warren-bank commented 9 months ago

the problem was that the fallback strategy assumed that the audio stream would be named stream_0, which is probably the case when the media only contains a single audio stream, but your example has 2: english and english - audio description

I just pushed v1.5.6.. which first tries to find the audio stream having one of the two names: stream_0 or english.. and if neither is found, it then walks the audio directory to find a suitable file.. and only exits with an error message when none can be found.

f1vefour commented 9 months ago

It's working now, ffmpeg falls back and joins the audio/video into mp4 correctly.

Thank you for the quick fix, closing the issue.