Android cannot play XAVC-S Videos – How to Fix

By | October 4, 2023

So i got my first ever camera, the sony zv-e10 and slowly learned that it records video in a format called XAVC-S for both 4K and 1080P. Now this XAVC-S standard actually uses h.264 under the hood, but it uses a high level profile of h.264 encoding which not all phone cpu hardware and soc's are capable of decoding.

For example the cpu (igpu) soc on your smartphone might be able to decode only upto h.264 Level5 whereas the xavc-s video is encoded with a higher standard of h.264 Level5.1

Each level has a different spcecification for parameters like resolution, framerate and bitrate. More about this can be found at the wikipedia page.

Due to this a lot of android smartphones, based on specific cpu socs like Mediatek Helio G80 (MT6768) and Qualcomm Snapdragon 662 QTI SM6115 cannot open/play the video file, because the particular cpu being used does not support the full range of h.264 profiles and levels.

The video file will not play in media players like vlc and neither can be edited with InShot. Everything would be plain black.

The reasons is that video playback and processing on smartphones is always exclusively hardware accelerated, and if that is not supported, then the video will never work for anything.

Software decoding is an option in theory, but is never used in smartphones because it would put severe load on the mobiles cpu

XAVC-S Videos are h.264 Level 5.1 or 5.2 videos and the hardware decoder on the smartphone must be support decoding these levels of h.264 in order to play xavc-s videos. Otherwise it would fail

Based on XAVC-S support smart phones can be put in 3 categories:

1. Unsupported Smartphones: PHones like Moto G30 and older ones could not play the video at all.

2. Partial Support: Phones like Moto G31 can recognise and play the video but the playback is very choppy and laggy and is as good as USELESS.

3. Supported Smartphones: However some smartphones can handle this format. My Samsung Galaxy M30 and M31 were able to play and allow editing of the video in Inshot. The exynos cpu used on these phones is very capable when it comes to encoding and decoding higher profiles of h264 codecs.

A lot of people use smartphones for simple video editing and when creating youtube shorts, simply because apps like inshot make it simple and quick without the need of much technical knowledge.

Check the Video Profile and Level with ffprobe

If your xavc-s video is not playing on your smartphone, the first thing to do is to check the profile and level of the video itself. After that we shall check what profiles and levels are supported by the mobile phone.

The ffprobe (comes with ffmpeg) command is a very handy one and it quickly tells various attributes of any given video file, like the codec, container, bitrate, audio codec and so on.

The following example examines the details of a video file from sony zv-e10.

$ ffprobe -i C0205.MP4 -hide_banner
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55a3c4444180] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1001
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55a3c4444180] st: 0 edit list 1 Cannot find an index entry before timestamp: 1001.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C0205.MP4':
  Metadata:
    major_brand     : XAVC
    minor_version   : 16785407
    compatible_brands: XAVCmp42iso2
    creation_time   : 2023-09-30T08:55:35.000000Z
  Duration: 00:19:06.15, start: 0.000000, bitrate: 98486 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/iec61966-2-4, progressive), 3840x2160 [SAR 1:1 DAR 16:9], 95705 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2023-09-30T08:55:35.000000Z
      handler_name    : Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
    Side data:
      displaymatrix: rotation of -90.00 degrees
  Stream #0:1[0x2](und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2023-09-30T08:55:35.000000Z
      handler_name    : Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Data: none (rtmd / 0x646D7472), 1227 kb/s (default)
    Metadata:
      creation_time   : 2023-09-30T08:55:35.000000Z
      handler_name    : Timed Metadata Media Handler
      timecode        : 03:04:09:23
Unsupported codec with id 0 for input stream 2
$

From the above output we can see that

  • bitrate: 98486 kb/s ~ 100 Mbps
  • Video Type: h264 (High) (avc1 / 0x31637661)
  • encoder: AVC
  • resolution: 3840x2160 - 4K
  • pixel format: yuv420p (implies 8-bit colors)
  • displaymatrix: rotation -90 degrees (because it is a vertical video made for youtube shorts)

Now this particular video will play perfectly on any desktop computer using vlc player or ffmpeg based any other player like ffplay or mplayer or smplayer.

Check h.264 Level

The show_streams option will tell the level of the encoding whether 4 or 5 or 5.1 or 5.2. A simple command is as follows:

ffprobe -i C0205.MP4 -hide_banner -show_streams 2>&1 | grep -i level
level=51

The above output indicates Level = 5.1

To print all stream data of only the first video stream use the following command:

ffprobe -i C0205.MP4 -hide_banner -v error -select_streams v:0 -show_streams

The above command will display a huge bunch of details about the video somewhat like this:

$  ffprobe -i C0205.MP4 -hide_banner -v error -select_streams v:0 -show_streams
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_tag_string=avc1
codec_tag=0x31637661
width=3840
height=2160
coded_width=3840
coded_height=2160
closed_captions=0
film_grain=0
has_b_frames=1
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=51
color_range=tv
color_space=bt709
color_transfer=iec61966-2-4
color_primaries=bt709
chroma_location=left
field_order=progressive
refs=1
is_avc=true
nal_length_size=4
id=0x1
r_frame_rate=30000/1001
avg_frame_rate=30000/1001
time_base=1/30000
start_pts=0
start_time=0.000000
duration_ts=34384350
duration=1146.145000
bit_rate=95705744
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=34350
nb_read_frames=N/A
nb_read_packets=N/A
extradata_size=352
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=0
DISPOSITION:still_image=0
TAG:creation_time=2023-09-30T08:55:35.000000Z
TAG:language=und
TAG:handler_name=Video Media Handler
TAG:vendor_id=[0][0][0][0]
TAG:encoder=AVC Coding
[SIDE_DATA]
side_data_type=Display Matrix
displaymatrix=
00000000:            0       65536           0
00000001:       -65536           0           0
00000002:    141557760           0  1073741824

rotation=-90
[/SIDE_DATA]
[/STREAM]
enlightened@enlightened:/media/enlightened/757dcceb-3e17-4ca8-9ba1-b0cf68fb0134/2023-09-30$

To print both the h.264 profile and level of the video use the following command:

ffprobe -i C0205.MP4 -hide_banner -v error -select_streams v:0 -show_entries stream=profile,level -of default=noprint_wrappers=1
profile=High
level=51

Thats quite neat. More discussion about the command format can be found on this stackoverflow thread.

In case of xavc-s 4k videos the level will almost always be 5.1 or higher. And therefore the hardware decoder on your smartphone must be capable of decoding it in order to play it.

The quick solution - Downscale the resolution and bitrate

If an xavc-s video is not playing on your smartphone then there is nothing that can be done to make it play except changing the format by transcoding.

You need to process the video on a pc or laptop and convert it to a more compatible format that the phone can handle. This can be done using command line tools like ffmpeg which is easily available for most platforms like linux, windows and mac.

There are other gui tools as well and we shall take a look into those as well.

You can try re-encoding with the following commands (but it will not work!):

ffmpeg -i C0205.MP4 -c:v libx264 -b:v 100M -b:a 192k output.mp4 -hide_banner

The above command can take hours to complete, depending on the video duration and the hardware power of your system. It would be better to first run a smaller test conversion on a shorter duration of the video clip.

Use the -ss and -t option to run shorter test encodes and see if the output is acceptable for your requirements.

ffmpeg -i C0205.MP4 -c:v libx264 -b:v 100M -b:a 192k -ss 60 -t 10 output-libx264.mp4 -hide_banner

If it looks good, then run it over the whole length of the video without the ss and t parameters.

However, if the source video is 4K with bitrate of 100M then it will still be encoded with h264 Level 5.1 or above, which still might be incompatible with your smartphone.

Downscale to 1080p

The more reliable solution is to downscale the video. We have to downscale it to 1080p with bitrate of 50M to make it use Level 5.0 or lower.

# for normal horizontal videos
ffmpeg -i C0205.MP4 -c:v libx264 -vf scale=1920:-2 -b:v 50M -b:a 192k -ss 60 -t 10 output.mp4

# for vertical videos (like youtube shorts)
ffmpeg -i C0205.MP4 -c:v libx264 -vf scale=1080:-2 -b:v 50M -b:a 192k -ss 60 -t 10 output.mp4

With this conversion, ffmpeg uses h.264 Level 5.0 encoding which should be compatible with most smartphones.

Afterwards we shall do further research on how to check for xavc-s support on your smartphone.

Test XAVC-S Playback Support in Android Phones

On android phones the codecs and the underlying hardware works in a different way. Higher end android phones specially the ones from samsung will very likely be able to play xavc-s videos easily. However it might not be easy to tell this just by looking at the specifications.

Smartphones are SOCs (system on chips). The gpu is integrated in the cpu as an igpu and has video encode/decode capability. When you play a video hardware accelerated decoding is used. And when you record a video using the camera, hardware accelerated encoding is used.

Hence the mobile gpu must support both encode/decode functions for atleast some codecs to allow both recording and playback.

Codec Info

There is a free android app in playstore called Codec Info. It will show you all the supported codecs, on the particular device. Just install it and look for video decoders that are named like: *.video.decoder.avc and check the details at the bottom.

Moto G30: For example on my Moto G30 the decoder details shows the following:

Moto G30 Codec OMX QCom AVC Decoder

Moto G30 Codec OMX QCom AVC Decoder

Note that it supports only upto AVCLevel5. XAVC-S videos need support of AVCLevel51 or AVCLevel52 based on the video.

According to the specifications of AVC Levels on wikipedia, Level 5 does not fully support 4K, whereas our video from sony zv-e10 was shot in 4K@30fps. This is an important point to note.

Level 5.1 supports upto 4K @ 30fps and Level 5.2 supports upto 4k @ 60fps. These are important specification parameters that you need to know when choosing video formats for recording or transcoding.

Moto G31:

Moto G31 Codec OMX MTK Video Decoder AVC

Moto G31 Codec OMX MTK Video Decoder AVC

This mobile has a mediatek helio g80 mt6768 cpu chipset with ARM Mali G52 MC2 igpu. It reports support for AVCLevel51. The sony xavc-s videos i was testing were Level 5.1 and this mobile was able to play them. However the playback was choppy and laggy and not useful at all.

It was as good as not supported. The Mediatek cpu is clearly not capable of decoding high level h.264 encoded videos.

Samsung M30: Now lets take a look at the codec support in my Samsung M30 using the same app:

The next mobile is a budget samsung galaxy m30 that comes with a

Samsung M30 Codec OMX Exynos AVC Decoder

Samsung M30 Codec OMX Exynos AVC Decoder

Samsung M31

Samsung M31 Codec OMX Exynos AVC Decoder

Samsung M31 Codec OMX Exynos AVC Decoder

Note

On most phones you will find a decoder named c2.android.avc.decoder which is actually the software based decoder that does not use hardware accleration and will support Level 5.2 but the point is, its useless, since smartphones cannot play videos with software decoding. That would be extremely slow and drain away all the power of the phone.

Check Codecs specifications online

There are online websites that report video codec support for different smartphone models, however they may not be totally accurate. For example check the website devicespecifications.com.

Moto G30:
For the Moto G30 the following codecs are supported according to https://www.devicespecifications.com/en/model/ef6c55ac

  • 3GPP (3rd Generation Partnership Project, .3gp)
  • AVI (Audio Video Interleaved, .avi)
  • H.263
  • H.264 / MPEG-4 Part 10 / AVC video
  • MKV (Matroska Multimedia Container, .mkv .mk3d .mka .mks)
  • QuickTime (.mov, .qt)
  • MP4 (MPEG-4 Part 14, .mp4, .m4a, .m4p, .m4b, .m4r, .m4v)
  • WebM
  • WMV (Windows Media Video, .wmv)
  • Xvid

The above list gives no hint of whether the codecs are for just decoding or both decoding and encoding. This makes it difficult to judge the true capabilities of the phone pertaining to video support.

Samsung Galaxy M31:
The same website reports the following codecs for samsung galaxy m31.

  • 3GPP (3rd Generation Partnership Project, .3gp)
  • 3GPP2 (3rd Generation Partnership Project 2, .3g2)
  • AVI (Audio Video Interleaved, .avi)
  • Flash Video (.flv, .f4v, .f4p, .f4a, .f4b)
  • H.263
  • H.264 / MPEG-4 Part 10 / AVC video
  • H.265 / MPEG-H Part 2 / HEVC
  • MKV (Matroska Multimedia Container, .mkv .mk3d .mka .mks)
  • MP4 (MPEG-4 Part 14, .mp4, .m4a, .m4p, .m4b, .m4r, .m4v)
  • VC-1
  • VP8
  • VP9
  • WebM
  • WMV (Windows Media Video, .wmv)
  • WMV7 (Windows Media Video 7, .wmv)
  • WMV8 (Windows Media Video 8, .wmv)
  • Xvid

Comparing the above 2 lists, we can see a big difference in the number and type of codecs support by each smartphone, even though both are entry level cheap android 11 based. However the above list does not clearly mention which codecs are available for only decoding and which ones are available for both decoding and encoding.

The samsung m31 supports H.265, VC1, VP8 and VP9 which are more advanced than h.264. Whereas the moto g30 does not support these codecs. Another way to verify this information is to note the gpu name and then search google with the gpu name appended with "codecs".

There is another website called cpu-monkey.com that provides some details about codec support on various cpu/igpu soc chipsets. here are some examples.

The Samsung Galaxy M31 has the gpu :
ARM Mali-G72 MP3
Full specs: https://www.cpu-monkey.com/en/igpu-arm_mali_g72_mp3

The Moto G30 has gpu:
Qualcomm Adreno 610
Full specs: https://www.cpu-monkey.com/en/igpu-qualcomm_adreno_610

The specifications from cpu-monkey.com clearly reports which codecs are available encoding and which ones for encoding. Most codecs can be decoded, but not all can be encoded. This is the important thing to understand.

The inbuilt camera video recorder or video editors like Inshot, need encoding support for the specific codec they are using. Most smartphones can encode to h.264 anyways.

Conclusion

By now it should be fairly clear, that the cause of incompatibility is not the xavc-s format, but the supported h264 levels in the smartphone hardware. Older phones cannot decode Level 5.1 or above, whereas newer ones can.

If your smartphone is unable to play a particular xavc-s video, you just have to downscale its resolution and bitrate to bring it to a lower level specification and make it compatible with your smartphone.

The cpu on samsung mobile phones tend to perform a lot better than mediatek cpus when it comes to video format support. This is something that is already well known in the smartphone world.

People who want good video recording and editing capabilities in their phones often choose samsung phones over other standard qualcomm snapdragon based phones.

Iphone is another story that we shall look into some other time.

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].

Leave a Reply

Your email address will not be published. Required fields are marked *