How to fix "moov atom not found" error in ffmpeg?
Asked Answered
S

2

24

Well, I'm using this project to create a Telegram bot which receives URL of .mp4 files, downloads them on server and uploads them to Telegram.

Issue

Everything works fine so far, except converting certain .mp4 files.

For example if I use a sample .mp4 video from https://sample-videos.com/. Then it works fine and converts it successfully.

But if I use a video from some random website which is also simple .mp4 file, it doesn't work and throws this error:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1932420] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible! [mov,mp4,m4a,3gp,3g2,mj2 @ 0x1932420] moov atom not found data/720P_1500K_210306701.mp4: Invalid data found when processing input

Staten answered 29/4, 2019 at 2:40 Comment(4)
Share a failing mp4.Balthazar
This may be a video that has not been fully uploaded (e.g. live stream). Hopefully How to add a MOOV atom in a mp4 video file can help.Rimma
Give a try https://mcmap.net/q/410585/-how-to-add-a-moov-atom-in-a-mp4-video-file-closedBrightwork
In my case, I was trying to operate on a file with size zero. Make sure your file isn't empty.Punishable
T
0

Try using ffprobe on the video. If you are having issues with the probe too.. It could be that it is corrupted.

you can also try to do this before encoding

ffmpeg -i input.mp4 -c copy input_first_clean_pass.mp4

and then launch the command on input_first_clean_pass.mp4

Tag answered 21/4, 2023 at 15:36 Comment(2)
This worked for me, not sure why doing a -c copy first before re-encoding makes things work.Clarinda
This cannot work with a missing moov.Foliage
R
-3

This really depends on the software that handles the upload. The moov atom is either located at the beginning, or at the end of the file. If the software only looks at the first part of the file, and the moov atom is at the end, it will not know how to deal with that file until the file upload is completed.

What you could do, prior to uploading, is move the moov file to the start of the video, it's more likely that the software only checks for the moov atom at the start of the file. With ffmpeg, the command is:

ffmpeg -i input -c:v copy -c:a copy -movflags faststart output.mp4

That would move it to the start of the file. You will need to do this for every video though.

Royal answered 25/10, 2021 at 12:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.