Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files of recorded of Facebook MPEG-DASH streams are broken #2488

Closed
1 task done
MaximVol opened this issue Jun 4, 2019 · 3 comments · Fixed by #2559
Closed
1 task done

Files of recorded of Facebook MPEG-DASH streams are broken #2488

MaximVol opened this issue Jun 4, 2019 · 3 comments · Fixed by #2559
Labels

Comments

@MaximVol
Copy link

MaximVol commented Jun 4, 2019

Plugin Issue

  • This is a plugin issue and I have read the contribution guidelines.

Description

Streamlink produces broken files during recording of Facebook streams. Only small fragment of recorded file can be played, after this video freezes and only audio is playing.

Reproduction steps / Explicit stream URLs to test

This happens with any Facebook live stream. This is example of recorded file:
https://www.dropbox.com/s/04r53qctuoc85yb/test.ts?dl=1

Duration of recorded media is 2 minute, but only first 12 seconds can be played.

Log output

`streamlink -o test.ts "https://www.facebook.com/Fox4DFW/videos/460953291359115/" best
[cli][info] streamlink is running as root! Be careful!
[cli][info] Found matching plugin facebook for URL https://www.facebook.com/Fox4DFW/videos/460953291359115/
[cli][info] Available streams: 144p_alt (worst), 144p, 240p_alt, 240p, 360p_alt, 360p, 480p_alt, 480p, 720p_alt, 720p (best)
[cli][info] Opening stream: 720p (dash)
[download][test.ts] Written 5.7 MB (2m1s @ 15.9 KB/s)
^C
[stream.dash][warning] Download of segment: https://video-otp1-1.xx.fbcdn.net/hvideo-prn2-ash/v/rrejTXTVG8-z0ec49bal9/live-dash/live-hd1-v/10156192895032093_0-4036580.m4v aborted
[stream.ffmpegmux][error] Pipe copy aborted: /tmp/ffmpeg-27990-210
[cli][info] Stream ended
Interrupted! Exiting...
[cli][info] Closing currently open stream...`

FFMPEG says that duration of recorded media is unknown:

ffmpeg -hide_banner -i test.ts
Input #0, matroska,webm, from 'test.ts':
  Metadata:
    COMPATIBLE_BRANDS: isomiso6dash
    MAJOR_BRAND     : iso6
    MINOR_VERSION   : 1
    ENCODER         : Lavf57.71.100
  Duration: N/A, start: 3974.503000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720, 29.97 fps, 29.97 tbr, 1k tbn, 2k tbc (default)
    Metadata:
      HANDLER_NAME    : VideoHandler
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      HANDLER_NAME    : SoundHandler
At least one output file must be specified

Additional comments, screenshots, etc.

I tried to post-process the file by FFMPEG. This fixed issue with unknown duration, but only first 12 seconds still can be played.

ffmpeg -i test.ts -acodec copy -vcodec copy fixed.ts

ffmpeg -hide_banner -i fixed.ts
Input #0, mpegts, from 'fixed.ts':
  Duration: 00:01:53.24, start: 1.400000, bitrate: 468 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720, 29.97 fps, 29.97 tbr, 90k tbn, 2k tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 137 kb/s
At least one output file must be specified

I also tried to use more usual codecs for TS file, but result is the same:

streamlink -o test.ts --ffmpeg-video-transcode mpeg2video --ffmpeg-audio-transcode mp2 "https://www.facebook.com/Fox4DFW/videos/460953291359115/" best

@bastimeyer bastimeyer added the bug label Jun 13, 2019
@back-to
Copy link
Collaborator

back-to commented Jul 13, 2019

ffmpeg with -start_at_zero seems to fix this case

[stream.mp4mux-ffmpeg][debug] ffmpeg command: /usr/bin/ffmpeg -nostats -y
-i /tmp/ffmpeg-25336-131 -i /tmp/ffmpeg-25336-692
-c:v copy -c:a copy -copyts -start_at_zero -f matroska pipe:1

@MaximVol
Copy link
Author

I tested latest version of StreamLink and, unfortunately, "-start_at_zero" FFMPEG flag does not solve the issue. Sound in recorded file is ok, but video still freezes after 12-20 seconds.

@MaximVol

This comment has been minimized.

back-to added a commit to back-to/streamlink that referenced this issue Dec 13, 2020
- don't use `-start_at_zero` as default for `-copyts`
- revert streamlink#2559

- change command `--ffmpeg-no-start-at-zero` to `--ffmpeg-start-at-zero`
  (there was no release in between this command)

- use `--ffmpeg-start-at-zero` for the facebook plugin,
  because the original fix was for it.
  streamlink#2488
back-to added a commit that referenced this issue Dec 15, 2020
- don't use `-start_at_zero` as default for `-copyts`
- revert #2559

- change command `--ffmpeg-no-start-at-zero` to `--ffmpeg-start-at-zero`
  (there was no release in between this command)

- use `--ffmpeg-start-at-zero` for the facebook plugin,
  because the original fix was for it.
  #2488
Billy2011 pushed a commit to Billy2011/streamlink-27 that referenced this issue Dec 15, 2020
…lt (streamlink#3413)

- don't use `-start_at_zero` as default for `-copyts`
- revert streamlink#2559

- change command `--ffmpeg-no-start-at-zero` to `--ffmpeg-start-at-zero`
  (there was no release in between this command)

- use `--ffmpeg-start-at-zero` for the facebook plugin,
  because the original fix was for it.
  streamlink#2488
Billy2011 pushed a commit to Billy2011/streamlink-27 that referenced this issue Dec 17, 2020
…lt (streamlink#3413)

- don't use `-start_at_zero` as default for `-copyts`
- revert streamlink#2559

- change command `--ffmpeg-no-start-at-zero` to `--ffmpeg-start-at-zero`
  (there was no release in between this command)

- use `--ffmpeg-start-at-zero` for the facebook plugin,
  because the original fix was for it.
  streamlink#2488
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants