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

Corrupt FLV creation when downloading Twitch VODs #490

Closed
notr1ch opened this issue Aug 12, 2014 · 1 comment
Closed

Corrupt FLV creation when downloading Twitch VODs #490

notr1ch opened this issue Aug 12, 2014 · 1 comment

Comments

@notr1ch
Copy link

notr1ch commented Aug 12, 2014

It seems the .flv files produced by livestreamer for downloaded VODs are sometimes corrupted. This is reproducible with this particular VOD:

$ livestreamer -l debug -o Test.flv http://www.twitch.tv/onenationofgamers/b/557120291 best
[cli][info] Found matching plugin twitch for URL http://www.twitch.tv/onenationofgamers/b/557120291
[cli][info] Available streams: 720p (worst), source (best)
[cli][info] Opening stream: source (flv_playlist)
[cli][debug] Pre-buffering 8192 bytes
[stream.flv_playlist][debug] Opening substream: < HTTPStream('http://media-cdn.twitch.tv/store151.media100/archives/2014-8-11/live_user_onenationofgamers_1407793580.flv') >
[cli][debug] Checking file output
[cli][debug] Writing stream to output
Written 42242980 bytes^C

$ ffprobe Test.flv
avprobe version 0.8.15-6:0.8.15-1, Copyright (c) 2007-2014 the Libav developers
built on Aug 9 2014 10:19:49 with gcc 4.7.2
[flv @ 0x2165b20] decoding for stream 0 failed
[flv @ 0x2165b20] decoding for stream 1 failed
[flv @ 0x2165b20] Estimating duration from bitrate, this may be inaccurate
Test.flv: Operation not permitted

$ ./flv-analyzer Test.flv
FLV file version 1
Contains audio tags: Yes
Contains video tags: Yes
Data offset: 9

Prev tag size: 0
Tag type: 18 - Script data object
Data size: 17079
Timestamp: 0
Timestamp extended: 0
StreamID: 0

Prev tag size: 17090
Tag type: 18 - Script data object
Data size: 29
Timestamp: 0
Timestamp extended: 0
StreamID: 0

Prev tag size: 50333796
Tag type: 117 - Unknown tag type!
Error!

$ wget -O Test2.flv http://media-cdn.twitch.tv/store151.media100/archives/2014-8-11/live_user_onenationofgamers_1407793580.flv
--2014-08-12 19:03:14-- http://media-cdn.twitch.tv/store151.media100/archives/2014-8-11/live_user_onenationofgamers_1407793580.flv
Resolving media-cdn.twitch.tv (media-cdn.twitch.tv)... 8.27.9.126, 8.27.3.254, 209.84.17.254
Connecting to media-cdn.twitch.tv (media-cdn.twitch.tv)|8.27.9.126|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 562793650 (537M) [video/x-flv]
Saving to: `Test2.flv'

7% [============> ] 39,468,917 18.8M/s ^C

$ ffprobe Test2.flv
avprobe version 0.8.15-6:0.8.15-1, Copyright (c) 2007-2014 the Libav developers
built on Aug 9 2014 10:19:49 with gcc 4.7.2
[flv @ 0x1c65b20] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'Test2.flv':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0.0: Video: h264 (High), yuv420p, 1920x1080, 30 tbr, 1k tbn, 2k tbc
Stream #0.1: Audio: aac, 48000 Hz, stereo, s16

$ ./flv-analyzer Test2.flv
FLV file version 1
Contains audio tags: Yes
Contains video tags: Yes
Data offset: 9

Prev tag size: 0
Tag type: 18 - Script data object
Data size: 17079
Timestamp: 0
Timestamp extended: 0
StreamID: 0

Prev tag size: 17090
Tag type: 18 - Script data object
Data size: 345
Timestamp: 0
Timestamp extended: 0
StreamID: 0

Prev tag size: 356
Tag type: 8 - Audio data
Data size: 4
Timestamp: 0
Timestamp extended: 0
StreamID: 0
Audio tag:
Sound format: 10 - AAC
Sound rate: 3 - 44-Khz
Sound size: 1 - 16 bit
Sound type: 1 - Stereo

Prev tag size: 15
Tag type: 9 - Video data
Data size: 49
Timestamp: 0
Timestamp extended: 0
StreamID: 0
Video tag:
Frame type: 1 - keyframe (for AVC, a seekable frame)
Codec ID: 7 - AVC
AVC video tag:
AVC packet type: 0 - AVC sequence header
AVC composition time: 0

[etc]

While the VOD download was aborted with Ctrl+C, the full VOD also exhibits the same problem.

@chrippa
Copy link
Owner

chrippa commented Aug 12, 2014

This was a weird issue. Looks like any broadcast created after Twitch announced their new VOD changes contains an extra Script Data tag that causes my serializer to mess something up (I'll have to figure out why later). Simply ignoring it fixes the issue for now, sorry for the inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants