Skip to content

enable editing for videos supported by device, fix send mp4 document as video - #83

Closed
Dubzer wants to merge 2 commits into
teidesu:mainfrom
Dubzer:main
Closed

Dubzer wants to merge 2 commits into
teidesu:mainfrom
Dubzer:main

Conversation

@Dubzer

@Dubzer Dubzer commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

this PR enables editing of videos in formats such as AV1, AVP, H.266, etc., provided the device supports them

@teidesu teidesu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few nits from claude:

  • The probe and the converter can disagree on the decoder. findDecoderForFormat checks profile and size, but MediaCodecVideoConvertor.getDecoderByFormat uses createDecoderByType(mime), which takes the first decoder for the mime. Example: a hw AV1 decoder without 10-bit support is listed first, and the probe says yes only because of the sw c2.android.av1. The UI then allows editing and conversion fails. The fix is to pass the chosen codec name through, or at least accept that limit knowingly.
  • setDataSource(fd, fileOffset, Long.MAX_VALUE): offset + length overflows in the native FileSource. It should use File(path).length() - fileOffset.

Trace.beginSection("AnimatedFileNative#getVideoInfo");
try {
nGetVideoInfo(src, params, fileOffset);
+ desu.inugram.helpers.media.MediaSendHelper.updateVideoConversionSupport(src, params, fileOffset);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude says that this line makes av1/vvc videos transcoded to h264 even with no edits. is that correct/intended?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, you're right about transcoding. “Original” now preserves unedited videos regardless of codec. also separated the cache key so it won't reuse an older transcoded copy

converter now uses the same format-aware decoder lookup as the probe, so it can pick a compatible software decoder if needed

AOSP clamps the length before adding the offset, so the overflow shouldn't happen there, but changed it to the actual remaining file length anyway

upload cached documents again so Telegram receives their video attributes,
and regenerate thumbnails for the new upload
check Android decoder capabilities for codecs missing from the native allowlist, including AV1. keep crop controls disabled when video editing is unavailable and restore them when switching to photos
teidesu pushed a commit that referenced this pull request Nov 2, 2026
@teidesu

teidesu commented Nov 2, 2026

Copy link
Copy Markdown
Owner

merged in 2af7538, thanks!

@teidesu teidesu closed this Nov 2, 2026
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

Successfully merging this pull request may close these issues.

2 participants