Reputation: 714
I've used this example to try and "stream" an mp4 video with multiple parts using MediaSource. The files shouldnt be larger than 20mb due to host upload restrictions.
However I'm having trouble finding the correct encoder settings for it to work. The example files work fine if I use them on my code but everything I encode or "split" myself doesnt work.
Here is the metadata (ffmpeg -i) of the files:
file I want to encode:
Metadata:
major_brand : mp42
minor_version : 19529854
compatible_brands: mp42isom
creation_time : 2017-01-23T17:09:58.000000Z
Duration: 00:04:46.65, start: 0.000000, bitrate: 3033 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
creation_time : 2017-01-23T17:09:58.000000Z
handler_name : Sound Media Handler
Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 2836 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2017-01-23T17:09:58.000000Z
handler_name : Video Media Handler
encoder : AVC Coding
One of the working files (the format I need):
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp42avc1iso5
Duration: 00:01:00.19, start: 0.000000, bitrate: 734 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 65 kb/s (default)
Metadata:
handler_name : Bento4 Sound Handler
Stream #0:1(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x360, 612 kb/s, 23.96 fps, 24 tbr, 600 tbn, 1200 tbc (default)
Metadata:
handler_name : Bento4 Video Handler
Stream #0:2(eng): Data: none (rtp / 0x20707472), 45 kb/s (default)
Metadata:
handler_name : Bento4 Hint Handler
Stream #0:3(eng): Data: none (rtp / 0x20707472), 5 kb/s (default)
Metadata:
handler_name : Bento4 Hint Handler
One of the commands I tried to use:
ffmpeg -i inputvid.mp4 -vcodec libx264 -acodec aac -pix_fmt yuv420p -profile:v baseline -level 3 testvid.mp4
Also to split the file into multiple part Ive been using "mp4box" so far:
mp4box -splits 19000 testvid.mp4
What would be the appropiate arguments for the encoding I need?
And is mp4box for splitting ok or can i use ffmpeg for that aswell?
Thanks in advance!
Upvotes: 1
Views: 1293
Reputation: 714
Using chrome://media-internals/ I was able to figure out the required encoding which is apparently ISO BMFF.
After some more research I came up with this working command for encoding:
ffmpeg -i .input.mp4 -vcodec libx264 -acodec aac -pix_fmt yuv420p -movflags empty_moov+default_base_moof+frag_keyframe -profile:v baseline output.mp4
Upvotes: 6