threema-ch / threema-web

The Threema Web application.
GNU Affero General Public License v3.0
1k stars 107 forks source link

Why cannot I send a .webm video as a file? #331

Open ovalseven8 opened 7 years ago

ovalseven8 commented 7 years ago

Today I sent a .webm video and noticed that I cannot send it as a file in Threema web. While sending as a video is probably preferred most of the time, is there any reason for this?

ovalseven8 commented 5 years ago

@lgrahl Can this be closed?

lgrahl commented 5 years ago

No, this has been backed out from #858.

dbrgn commented 5 years ago

The reason is that Threema video messages are always sent in MP4/h264 format. Since we cannot easily re-encode videos in the browser (no API for that), we need to do that on the device. And decoding VP8/VP9 is not supported by iOS devices (on Android, VP9 is only supported on 4.4+).

In summary, we would need to do device codec support detection when deciding whether files can be sent as video or not. Right now, that is not a priority.

I'll close this issue for now, but it's still open for comments.


Quick sidenote: On Android, codecs can be queried like this:

int numCodecs = MediaCodecList.getCodecCount();
for (int i = 0; i < numCodecs; i++) {
    MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
    logger.info("Codec: " + codecInfo.getName() + " / " + StringConversionUtil.join(", ", codecInfo.getSupportedTypes()) + " [encoder=" + codecInfo.isEncoder() + "]");
}

This is what it looks like:

Codec: OMX.google.aac.decoder / audio/mp4a-latm [encoder=false]
Codec: OMX.google.amrnb.decoder / audio/3gpp [encoder=false]
Codec: OMX.google.amrwb.decoder / audio/amr-wb [encoder=false]
Codec: OMX.google.flac.decoder / audio/flac [encoder=false]
Codec: OMX.google.g711.alaw.decoder / audio/g711-alaw [encoder=false]
Codec: OMX.google.g711.mlaw.decoder / audio/g711-mlaw [encoder=false]
Codec: OMX.google.gsm.decoder / audio/gsm [encoder=false]
Codec: OMX.google.mp3.decoder / audio/mpeg [encoder=false]
Codec: OMX.google.opus.decoder / audio/opus [encoder=false]
Codec: OMX.google.raw.decoder / audio/raw [encoder=false]
Codec: OMX.google.vorbis.decoder / audio/vorbis [encoder=false]
Codec: OMX.google.aac.encoder / audio/mp4a-latm [encoder=true]
Codec: OMX.google.amrnb.encoder / audio/3gpp [encoder=true]
Codec: OMX.google.amrwb.encoder / audio/amr-wb [encoder=true]
Codec: OMX.google.flac.encoder / audio/flac [encoder=true]
Codec: OMX.qcom.video.decoder.avc / video/avc [encoder=false]
Codec: OMX.google.h264.decoder / video/avc [encoder=false]
Codec: OMX.qcom.video.decoder.h263 / video/3gpp [encoder=false]
Codec: OMX.google.h263.decoder / video/3gpp [encoder=false]
Codec: OMX.google.hevc.decoder / video/hevc [encoder=false]
Codec: OMX.qcom.video.decoder.mpeg2 / video/mpeg2 [encoder=false]
Codec: OMX.qcom.video.decoder.mpeg4 / video/mp4v-es [encoder=false]
Codec: OMX.google.mpeg4.decoder / video/mp4v-es [encoder=false]
Codec: OMX.qcom.video.decoder.vp8 / video/x-vnd.on2.vp8 [encoder=false]
Codec: OMX.google.vp8.decoder / video/x-vnd.on2.vp8 [encoder=false]
Codec: OMX.google.vp9.decoder / video/x-vnd.on2.vp9 [encoder=false]
Codec: OMX.qcom.video.encoder.avc / video/avc [encoder=true]
Codec: OMX.google.h264.encoder / video/avc [encoder=true]
Codec: OMX.qcom.video.encoder.h263 / video/3gpp [encoder=true]
Codec: OMX.google.h263.encoder / video/3gpp [encoder=true]
Codec: OMX.qcom.video.encoder.mpeg4 / video/mp4v-es [encoder=true]
Codec: OMX.google.mpeg4.encoder / video/mp4v-es [encoder=true]
Codec: OMX.qcom.video.encoder.vp8 / video/x-vnd.on2.vp8 [encoder=true]
Codec: OMX.google.vp8.encoder / video/x-vnd.on2.vp8 [encoder=true]
Codec: OMX.google.vp9.encoder / video/x-vnd.on2.vp9 [encoder=true]

Unfortunately, even with this information, we would still need to be able to parse the container format (like mp4, webm or mkv) to detect the codec inside. And then we would need to map that codec to the MIME types returned by Android (e.g. video/x-vnd.on2.vp8 for VP8).

lgrahl commented 5 years ago

I'll reopen it because the thing is... @ovalseven8 actually wants to send it as a file but the Threema app has its own mind. None of this should matter if the video is being sent as a file. This should be fixed.

dbrgn commented 5 years ago

Yep, although that's definitely an app bug (ANDR-962).