streamlink / streamlink

Streamlink is a CLI utility which pipes video streams from various services into a video player
https://streamlink.github.io/
BSD 2-Clause "Simplified" License
9.92k stars 1.1k forks source link

Funimation subtitle mux failing #2615

Closed jrobinson52 closed 4 years ago

jrobinson52 commented 5 years ago

Plugin Issue

Description

When attempting to stream a Funimation stream (to file or VLC), ffmpeg throws an error but only when including the --funimation-mux-subtitles option. (The same stream works without the subtitles)

Reproduction steps / Explicit stream URLs to test

  1. Install streamlink (pacman)
  2. Run the following command:

    streamlink --http-cookie incap_ses_440_998813="wTEOEK+nzBvDS72lVzMbBsNocF0AAAAASq0j0fwk2p8r1g8YEMVWlw==" --funimation-language ja --funimation-mux-subtitles https://www.funimation.com/shows/assassination-classroom/assassination-time/?qid=undefined best -o test.flv

This will not work. However, when you remove --funimation-mux-subtitles the stream completes successfully.

Log output

(The error is not completely visible without --ffmpeg-verbose so I have included it in the log generation)

[cli][debug] OS:         Linux-4.19.66-1-MANJARO-x86_64-with-arch-Manjaro-Linux
[cli][debug] Python:     3.7.4
[cli][debug] Streamlink: 1.2.0
[cli][debug] Requests(2.22.0), Socks(1.7.0), Websocket(0.56.0)
[cli][info] Found matching plugin funimationnow for URL https://www.funimation.com/shows/assassination-classroom/assassination-time/?qid=undefined
[cli][debug] Plugin specific arguments:
[cli][debug]  --funimation-language=ja (language)
[cli][debug]  --funimation-mux-subtitles=True (mux_subtitles)
[plugin.funimationnow][debug] Found experience ID: 123596
[plugin.funimationnow][debug] Requesting experience data: https://www.funimation.com/api/experience/123596/
[plugin.funimationnow][debug] Making request to https://www.funimation.com/api/experience/123596/
[plugin.funimationnow][debug] Found episode: Assassination Time
[plugin.funimationnow][debug]   has languages: japanese, english
[plugin.funimationnow][debug]   requested language: japanese
[plugin.funimationnow][debug]   current language:   english
[plugin.funimationnow][debug] switching language to: japanese
[plugin.funimationnow][debug] Requesting experience data: https://www.funimation.com/api/experience/19468/
[plugin.funimationnow][debug] Making request to https://www.funimation.com/api/experience/19468/
[plugin.funimationnow][debug] New experience ID: 19468
[plugin.funimationnow][debug] Subtitles: https://d132fumi6di1wa.cloudfront.net/FunimationStoreFront/1287769/Japanese/1287769_Japanese_66f7e6b4-dc4a-e711-8175-020165574d09.vtt
[plugin.funimationnow][debug] Subtitles: https://d132fumi6di1wa.cloudfront.net/FunimationStoreFront/1287769/Japanese/1287769_Japanese_68f7e6b4-dc4a-e711-8175-020165574d09.dfxp
[plugin.funimationnow][debug] Subtitles: https://d132fumi6di1wa.cloudfront.net/FunimationStoreFront/1287769/Japanese/1287769_Japanese_69f7e6b4-dc4a-e711-8175-020165574d09.srt
[plugin.funimationnow][debug] Making request to https://www.funimation.com/api/showexperience/19468/
[utils.l10n][debug] Language code: en_US
[cli][info] Available streams: 234p_alt2 (worst), 234p_alt, 234p, 270p_alt2, 270p_alt, 270p, 360p_alt2, 360p_alt, 360p, 480p, 540p_alt2, 540p_alt, 540p, 720p_alt2, 720p_alt, 720p, 810p_alt2, 810p_alt, 810p, 1080p_alt2, 1080p_alt, 1080p (best)
[cli][info] Opening stream: 1080p (muxed-stream)
[stream.ffmpegmux][debug] Opening hls substream
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Segments in this playlist are encrypted
[stream.hls][debug] First Sequence: 0; Last Sequence: 177
[stream.hls][debug] Start offset: 0; Duration: None; Start Sequence: 0; End Sequence: 177
[stream.hls][debug] Adding segment 0 to queue
[stream.ffmpegmux][debug] Opening http substream
[stream.hls][debug] Adding segment 1 to queue
[stream.hls][debug] Adding segment 2 to queue
[stream.hls][debug] Adding segment 3 to queue
[stream.hls][debug] Adding segment 4 to queue
[stream.hls][debug] Adding segment 5 to queue
[stream.hls][debug] Adding segment 6 to queue
[stream.hls][debug] Adding segment 7 to queue
[stream.hls][debug] Adding segment 8 to queue
[stream.hls][debug] Adding segment 9 to queue
[stream.hls][debug] Adding segment 10 to queue
[stream.hls][debug] Adding segment 11 to queue
[stream.hls][debug] Adding segment 12 to queue
[stream.hls][debug] Adding segment 13 to queue
[stream.hls][debug] Adding segment 14 to queue
[stream.hls][debug] Adding segment 15 to queue
[stream.hls][debug] Adding segment 16 to queue
[stream.hls][debug] Adding segment 17 to queue
[stream.hls][debug] Adding segment 18 to queue
[stream.hls][debug] Adding segment 19 to queue
[stream.hls][debug] Adding segment 20 to queue
[stream.hls][debug] Adding segment 21 to queue
[stream.ffmpegmux][debug] ffmpeg command: ffmpeg -nostats -y -i /tmp/ffmpeg-12065-777 -i /tmp/ffmpeg-12065-698 -c:v copy -c:a copy -map 0 -map 1 -metadata:s:s:0 language=eng -metadata:s:a:0 language=jpn -f matroska pipe:1
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/ffmpeg-12065-777
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/ffmpeg-12065-698
[cli][debug] Pre-buffering 8192 bytes
ffmpeg version n4.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[stream.hls][debug] Download of segment 0 complete
[stream.hls][debug] Adding segment 22 to queue
Input #0, mpegts, from '/tmp/ffmpeg-12065-777':
  Duration: N/A, start: 1.440756, bitrate: N/A
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 245 kb/s
[stream.ffmpegmux][debug] Pipe copy complete: /tmp/ffmpeg-12065-698
Input #1, webvtt, from '/tmp/ffmpeg-12065-698':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Subtitle: webvtt
[matroska @ 0x55d728d3a900] Error parsing AAC extradata, unable to determine samplerate.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #1:0 -> #0:2 (webvtt (native) -> ass (ssa))
    Last message repeated 1 times
[stream.ffmpegmux][error] Pipe copy aborted: /tmp/ffmpeg-12065-777
[cli][debug] Checking file output
[cli][debug] Writing stream to output

[stream.ffmpegmux][debug] Closing ffmpeg thread
[stream.segmented][debug] Closing worker thread
[stream.segmented][debug] Closing writer thread
[stream.ffmpegmux][debug] Closed all the substreams
[cli][info] Stream ended
[cli][info] Closing currently open stream...
[stream.ffmpegmux][debug] Closing ffmpeg thread
[stream.ffmpegmux][debug] Closed all the substreams
[stream.ffmpegmux][debug] Closing ffmpeg thread
[stream.ffmpegmux][debug] Closed all the substreams

Additional comments, screenshots, etc.

This will create a file but it is only 365bytes.

Love Streamlink? Please consider supporting our collective. Thanks!

beardypig commented 5 years ago

Could be an issue with their stream. Could you try and add --ffmpeg-audio-transcode aac and see if that fixes the issue. If not, we'll have to add some extra options to customise the ffmpeg invocation to add other options...

jrobinson52 commented 5 years ago

Adding that option appears to fix the issue. The stream completed successfully and had subtitles as expected.