Giter VIP home page Giter VIP logo

telegram-media-deserialize's Introduction

Build

cargo build --release

Executable file should exist at target/release/telegram-media-deserialize.

That's it.

Usage

telegram-media-deserialize <serialized_file> <deserialized_file>

Make note of 'Last contiguous offset' info printed (see below).

Info

Telegram Desktop's media (Videos/Audios) are cached in media_cache (usually at: ~/.local/share/TelegramDesktop/tdata/user_data/media_cache) and can be decrypted using a python script available here:

https://github.com/lilydjwg/telegram-cache-decryption

You may notice that not all decrypted media files are playable, and there are no files that are larger than 10MiB.

Telegram Desktop (as of Dec 2022) seem to split larger media files into multiple cache files, the first of which is serialized for streaming purposes (other split cache files may not exist if the media is not fully cached).

Serialization is simple, the serialized cache file contains one or more slices, each slice is split into multiple parts.

A slice header is simply 4 bytes indicating the number of parts in it.

A part header is simply 8 bytes, with the first four indicating the deserialized media stream offset, followed by four bytes indicating the part byte size.

Note that parts are not necessarily contiguous, or ordered over multiple slices. The reader side of this serialized cache file emulates a media player, so if an MP4 file has a moov atom necessary for playback at the end of the media file, the reader will seek to the end and read from there, then come back (in the next slice).

The next split cache files are not serialized, and can simply be appended. But it should be noted that parts written with a forward seek (as described above) leaving a hole in the deserialized stream should be discarded. Check the Last contiguous offset value in program output.

Final note, there are a few bytes left after the parsed slices in the serialized file. I don't know what they are. But simply discarding them worked for me.

telegram-media-deserialize's People

Stargazers

Ahmad Syarifuddin Randiko avatar  avatar  avatar Maxim Zasorin avatar Radik Islamov avatar Stefan avatar

Watchers

 avatar

telegram-media-deserialize's Issues

"'path\<deserialized_file>' already exists" error while trying to execute

Hi, I don't seem to understand how the usage of this tool works.
According to the infos, after cache files have been decrypted, it's supposed to take as first parameter the serialized file of the two in the same folder of the decrypted files, while taking as second parameter the other one.
I tried to do it and even swapping them, but in both cases it returns me the error as from title.
What am I doing wrong?

How to find the next file name?

After deserialized a file, the left part is stored in another file. Then what's the relation between different file? How to find which file is needed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.