Opened 4 years ago

Last modified 3 years 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 (7)

comment:1 follow-up: Changed 4 years ago by Timothy_Gu

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

comment:2 Changed 4 years ago by Timothy_Gu

  • Component changed from undetermined to avformat
  • Description modified (diff)
  • Reproduced by developer set
  • Status changed from new to open

comment:3 Changed 4 years ago by Timothy_Gu

  • Component changed from undetermined to avformat
  • Description modified (diff)
  • Reproduced by developer set
  • Status changed from new to open

comment:4 Changed 4 years ago by cehoyos

  • Keywords flv added

comment:5 Changed 4 years ago by ElDimentio

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 Changed 3 years ago by cehoyos

  • Keywords xv removed

comment:7 in reply to: ↑ 1 Changed 3 years ago by al3x

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.

Note: See TracTickets for help on using tickets.