Why mp4 can not shared on Facebook or Instagram on Android?
Asked Answered
B

0

1

This is the file: https://t44-post-cover.s3.eu-central-1.amazonaws.com/2e3s.mp4

When I download and try share, it fails. Why? This is the parameters was rendered. Downloading and sharing works from iPhone to Facebook on Messenger or Instagram, but not from Android phone to Facebook on Messenger or Instagram.

What parameters ffpmpeg need to be able to share mp4 from Android to Facebook / Instagram?

await new Promise<void>((resolve, reject) => {
        ffmpeg()
            .setFfmpegPath(pathToFfmpeg)
            .input(`/tmp/input_${imgId}.gif`)
            .inputFormat('gif')
            .inputFPS(30)
            .input('anullsrc')
            .inputFormat('lavfi')
            .audioCodec('aac')
            .audioChannels(2)
            .audioFilters(['apad'])
            .videoCodec('libx264')
            .videoBitrate(1000)
            .videoFilters([
                'tpad=stop_mode=clone:stop_duration=2',
                'scale=trunc(iw/2)*2:trunc(ih/2)*2:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse',
            ])
            .fps(30)
            .duration(5)
            .format('mp4')
            .outputOptions([
                '-pix_fmt yuvj420p',
                '-profile:v baseline',
                '-level 3.0',
                '-crf 17',
                '-movflags +faststart',
                '-movflags frag_keyframe+empty_moov',
            ])
            .output(`/tmp/output_${imgId}.mp4`)
            .on('end', () => {
                console.log('MP4 video generated')
                resolve()
            })
            .on('error', (e) => {
                console.log(e)
                reject()
            })
            .run()
    })
Brunet answered 8/1, 2023 at 12:14 Comment(1)
Why are there two movflags? The 2nd is overriding the first one. And unless you have a specific reason, the 2nd one is not needed.Klimesh

© 2022 - 2024 — McMap. All rights reserved.