2

I used avconv and ffmpeg to convert video files, but these files after this process did not work on a mobile browser. They only work as well on VLC or any other browser of desktop (Linux or Windows).

And I just used all of codes for conversion seen in the StackOverflow! MP4 or WebM using H264 or VP9 codec do not work.

The last code which I used is this:

ffmpeg -i buck.webm -b 1500k -vcodec libx264 -profile:v baseline -g 30 "example.mp4"

Works fine on a PC, but does not work in a mobile browser (Chrome or Firefox).

How should I proceed?

4
  • On your mobile device what happens if you are trying to play HDready, full HD Quad HD... That is can your device play our favorite formates? If not try to encode in a smaller formate!! Feb 15, 2016 at 15:50
  • Am I mistaken in believing that x264 and webm don't mix? Normally x264 uses an mkv container while webm... well webm only supports webm video codec (VP8 VP9).
    – earthmeLon
    Feb 15, 2016 at 18:11
  • You should show the complete console output from your command.
    – llogan
    Feb 16, 2016 at 6:43
  • The mobile device play as well all videos converted in mac with the same especifications and mime-type. The complete output is a long text to put here, but don't return any error. even a basic example of converting from avconv, the video who are made with it don't works. Feb 17, 2016 at 12:39

1 Answer 1

7

Have a close look at this document for android developers:

Supported Media Formats

Note that this gives only baseline settings and any given mobile device might provide support for additional formats or file types not listed in the table.

Based on this it looks like your choice of video codec and settings for this codec are acceptable but you would be better to specify aac for the audio codec in your commandline. This would hopefully allow for a wide range of devices with successful playback.

A suggested commandline for FFmpeg would be:

ffmpeg -i input \
        -c:v libx264 -preset slow -crf 22 \
        -profile:v baseline -level 3.0 \
        -movflags +faststart -pix_fmt yuv420p \
        -c:a libfdk_aac -b:a 128k \
        output.mp4

Some points for this choice of commandline:

  1. For the greatest compatibility with a wide range of devices it is recommended to use -profile:v baseline -level 3.0
  2. It is an idea to add -movflags +faststart if your file is going to be displayed online, with this setting it should start playback before fully downloaded
  3. Use -pix_fmt yuv420p to allow playback on a wider range of devices
  4. libfdk_aac gives better AAC sound than the native FFmpeg AAC encoder (when this encoder was still marked 'experimental')

I have provided a working sample here for testing purposes using this command line; and I note that this file works perfectly with my Google Pixel 3a (Android).

10
  • I already used AAC codecs and VP8 and VP9 video codec and the problem still here. i just used the codecs used before in the program who i'm used in Mac. Feb 17, 2016 at 12:28
  • Hmmm.... my understanding of that page is that you should be safe using h.264 with baseline profile and aac sound. Can you load a small sample of one of your converted files somewhere? I will produce one on my own system, upload it, and see if this will make your device happy...
    – andrew.46
    Feb 18, 2016 at 8:16
  • I used a lot of combination of command, but the last one ofmy script it's this: avconv -i "/home/web-tec/Jobs/lindinho/arquivo.mov.MP4" -strict experimental -preset veryslow -c:v libx264 -pix_fmt yuv420p -b:v 1200k -crf 27 -profile:v baseline -vf "setsar=1:1" -s:v 720x480 -ar 44100 -ac 1 -acodec aac -b:a 160k -movflags faststart /home/web-tec/Jobs/lindinho/daa.mp4 Feb 18, 2016 at 13:18
  • Thanks, this is very useful but this do not solved my problem. I used the same code that you sent and just dont works as well in mobile. irdeb.ba.gov.br/fabiob.mp4 ffmpeg -i input.mov -c:v libx264 -preset slow -crf 22 -profile:v baseline -level 3.0 -movflags +faststart -pix_fmt yuv420p -c:a libfdk_aac -b:a 128k fabiob.mp4 Feb 22, 2016 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .