Opened 10 years ago

Last modified 13 months ago

#3720 open enhancement

Support decoding of Xunlei XV file

Reported by: ElDimentio Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: flv
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by Timothy Gu)

Xunlei is a major Chinese corporation with a monopoly on video downloading in China; they allow to download and play all sorts of Chinese TV shows for free but they're all in XV format, which is only supported by a video player Xunlei made. The video is H.264 video. FFmpeg cannot play this. When I try "ffmpeg -i 1.xv" I get the following: http://i.imgur.com/PrRNzvs.png

Here is a link to 1.xv: https://www.dropbox.com/s/0rlzjm9b1apg0j5/1.xv

1.xv is 180MB, and it's supposed to be a video of about 45 minutes. Thanks!

Change History (8)

comment:1 by Timothy Gu, 10 years ago

There is a reverse engineered converter of xv -> flv (ugh) at https://gist.github.com/m13253/8298996

comment:2 by Timothy Gu, 10 years ago

Component: undeterminedavformat
Description: modified (diff)
Reproduced by developer: set
Status: newopen

comment:3 by Timothy Gu, 10 years ago

Component: undeterminedavformat
Description: modified (diff)
Reproduced by developer: set
Status: newopen

comment:4 by Carl Eugen Hoyos, 10 years ago

Keywords: flv added

comment:5 by ElDimentio, 10 years ago

I compiled the reverse engineered converter you linked to in github and it was able to successfully convert the file (1.xv) and it also converted a lot of other videos perfectly to FLV, but about a third of them gave me the error in line 61 "File format is incorrect".

In case it would help you guys decode the format, I have uploaded one of the videos that the code on github was not able to decode: https://www.dropbox.com/s/tifc7r5umr6cg1p/5.xv

comment:6 by Carl Eugen Hoyos, 10 years ago

Keywords: xv removed

in reply to:  1 comment:7 by al3x, 9 years ago

Replying to Timothy_Gu:

There is a reverse engineered converter of xv -> flv (ugh) at https://gist.github.com/m13253/8298996

I have checked out this converter and it is a funny one. It descrambles the actual FLV header way down in the file and replaces the header with an "unknown FLV chunk" (type 255) so it will be properly skipped.

The file format starts with the magic XLVF, seems to have a 32 bit pointer to the actual data at position 8 (e.g. 0x00200000 in the two files). After that a URL to the original .flv follows and perhaps some index data.

At the referenced position, the first 0x400 (1024) bytes have to be adjusted:

val = (val + 0x39) & 0xff

or

val = (val - 0xc7) & 0xff

After that, it can be read as an FLV file.

comment:8 by barsnick, 6 years ago

To me it seems these files can be decoded just fine using

ffmpeg -f flv -i 1.xv -f null -

(or remuxed to a file which apparently contains the complete video and is perfectly playable).

Just the information from the scrambled FLV header is missing:

[flv @ 0x55baa1f2b240] Read FLV header error, input file is not a standard FLV format, first PreviousTagSize0 always is 0
[flv @ 0x55baa1f2b240] Packet mismatch 32 11 11

implying you can't probe bitrate or duration.

Would it not suffice to recognize these files properly as FLV in the first step?

Note: See TracTickets for help on using tickets.