signalapp / Signal-Android

A private messenger for Android.
https://signal.org
GNU Affero General Public License v3.0
25.21k stars 6.07k forks source link

Video file transcoded unnecessarily before sending; inflates a 12MB video to almost 90MB! #13511

Open cousinit99 opened 3 months ago

cousinit99 commented 3 months ago

Bug description

Sending videos takes forever because Signal Android performs some kind of processing prior to sending. This processing inexplicably takes a 12MB H.264 640x360 video with a 167kbps total bitrate, and somehow inflates it to almost 90MB.

Steps to reproduce

Actual result: The video takes roughly 5 minutes to process before even starting to upload. The upload then begins for an 88MB file. Expected result: No processing or transcoding delay occurs, the video is uploaded at a size no larger than the source, and the upload is virtually instantaneous. The Signal desktop app behaves exactly this way for the same video file using the same internet connection.

Device info

Device: OnePlus Open Android version: 13 Signal version: 7.3.1

Link to debug log

https://debuglogs.org/android/7.3.1/28a1ea63cbc652c60d2300faaa566648894a66f2f102d751e0d80a25e03d3c37)

Video file meta

Video
ID                          : 1
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High@L3
Format settings             : CABAC / 4 Ref Frames
Format settings, CABAC      : Yes
Format settings, Reference  : 4 frames
Codec ID                    : avc1
Codec ID/Info               : Advanced Video Coding
Duration                    : 9 min 26 s
Bit rate                    : 36.9 kb/s
Width                       : 640 pixels
Height                      : 360 pixels
Display aspect ratio        : 16:9
Frame rate mode             : Constant
Frame rate                  : 30.000 FPS
Color space                 : YUV
Chroma subsampling          : 4:2:0
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 0.005
Stream size                 : 2.49 MiB (21%)
Title                       :
Writing library             : x264 core 164 r3081 19856cc
Encoding settings           : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=11 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Color range                 : Limited
Color primaries             : BT.709
Transfer characteristics    : BT.709
Matrix coefficients         : BT.709
Codec configuration box     : avcC

Audio
ID                          : 2
Format                      : AAC LC
Format/Info                 : Advanced Audio Codec Low Complexity
Codec ID                    : mp4a-40-2
Duration                    : 9 min 26 s
Source duration             : 9 min 26 s
Bit rate mode               : Constant
Bit rate                    : 130 kb/s
Channel(s)                  : 2 channels
Channel layout              : L R
Sampling rate               : 44.1 kHz
Frame rate                  : 43.066 FPS (1024 SPF)
Compression mode            : Lossy
Stream size                 : 8.75 MiB (74%)
Source stream size          : 8.75 MiB (74%)
Title                       :
Default                     : Yes
Alternate group             : 1
satvik2131 commented 3 months ago

I am able to experience the delay in upload , but my file size is not inflating , can you upload screenshots

ghost commented 3 months ago

I experienced a similar issue from uploading a video file from iCloud to Signal (on iOS), it got from ca. 49MB inflated to ca. 101MB

cousinit99 commented 3 months ago

I am able to experience the delay in upload , but my file size is not inflating , can you upload screenshots

The original file size is ~12MB. Screenshot_2024-04-15-07-32-52-67_4b14b257287ac0a6d1fd5fbb2487716f_1 Screenshot_2024-04-15-07-37-16-79_4b14b257287ac0a6d1fd5fbb2487716f_1

satvik2131 commented 3 months ago

Hi @cousinit99 , can you also upload the debug log

cousinit99 commented 3 months ago

Hi @cousinit99 , can you also upload the debug log

It's in the OP.

satvik2131 commented 3 months ago

Screencast from 19-04-24 10:07:53 PM IST.webm Hi @cousinit99 , I am actually experiencing a decrease(compression) in file size , am I reproducing correct ? if yes , please pass me the file which is causing the issue

cousinit99 commented 3 months ago

The video is mostly audio in terms of content. The visual is essentially a static picture with subtitles. Very little changes from one frame to the next. The subtitles are all that change visually. There's a great deal of temporal redundancy. My guess is that the encoder is removing the motion vector compression from the original file.

stale[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.