Uploaded videos are not playing in mobile browser but are playing on desktop broswer -
i have set server (gunicorn , nginx) upload videos using python/django, , watch them in browser. video player using videojs. videos h.264 mp4. , video size between 5-40 mb.
the video uploads fine , can watch uploaded video on desktop , laptop browser too.
the problem can't watch same videos (which playing on desktop browser) on mobile devices.
i error:
this video not loaded, either because server or network failed or because format not supported.
what wrong?
update
however tested mobile browsers webm videos in mobile , opera , chrome plays video perfectly. command used webm:
ffmpeg -i test2.mov -codec:v libvpx -quality -cpu-used 0 -b:v 600k -maxrate 600k -bufsize 1200k -qmin 10 -qmax 42 -vf scale=-1:480 -threads 4 -codec:a vorbis -b:a 128k -strict -2 test2_webmmm.webm
and h.264 mp4 (only working firefox):
ffmpeg -i inputfile.avi -codec:v libx264 -profile:v baseline -preset slow -b:v 250k -maxrate 250k -bufsize 500k -vf scale=-1:360 -threads 0 -codec:a libfdk_aac -b:a 96k output.mp4
update
input #0, mov,mp4,m4a,3gp,3g2,mj2, 'faststart.mp4': metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : lavf56.40.100 duration: 00:03:36.56, start: 0.046440, bitrate: 350 kb/s stream #0:0(und): video: h264 (constrained baseline) (avc1 / 0x31637661), yu v420p, 640x360 [sar 1:1 dar 16:9], 249 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.9 5 tbc (default) metadata: handler_name : videohandler stream #0:1(und): audio: aac (lc) (mp4a / 0x6134706d), 44100 hz, stereo, flt p, 96 kb/s (default) metadata: handler_name : soundhandler
update
here points gathered along way:
- some of videos downloaded youtube , uploaded on server without encoding playing nicely on browsers.
- however if encode same video (youtube video) , upload on server, not play on mobile devices on desktop browsers.
- videos took mobile (samsung s4 , iphone 6), , encode ffmpeg not playing on mobile browsers, on desktop browsers.
- but, url of same videos (which took mobile) hosted on amazon s3 playing nicely on browsers (even non encoded videos).
what official documentation tells:
streaming , aac player compatibility
by default when encoding aac files using libfdk_aac metadata ('moov' atom) written after audio stream ('mdat' atom) @ end of file. in order enable streaming of encoded file 'moov' atom has moved before 'mdat' atom. in addition aac player implementations have issues decoding such files.
ffmpeg offers option '-movflags +faststart' covering functionality can used during encoding:
ffmpeg -i input.wav -c:a libfdk_aac -movflags +faststart output.m4a
existing m4a files can modified "qt-faststart' program distributed ffmpeg in 'tools' directory
qt-faststart input.m4a output.m4a
so can try this:
ffmpeg -i inputfile.avi -codec:v libx264 -profile:v baseline -preset slow -b:v 250k -maxrate 250k -bufsize 500k -vf scale=-1:360 -threads 0 -codec:a libfdk_aac -movflags +faststart output.mp4
Comments
Post a Comment