How to fix "moov atom not found" error in ffmpeg? - ffmpeg

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

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.

Related

Codec that converts amr-wb multichannel file to mpeg3 or .wav needed

I've got Linux Ubuntu and ffmpeg version 4.3-2. It converts monochannel 16kHz 16kbit/s amr-wb files to wav without any problems, but when it comes to amr-wb multichannel files the output is:
filename.amr: Operation not permitted
I've already tried for test purposes to encode a stereo.wav file into an amr-wb file, but without success. The ffmpeg codec converts it into a normal monofile with just one channel. Seems that the multichannel mode is unknown for it.
Any idea?
Thanks in advance.

Any working example recording a (e.g. rtsp) stream to a local MP4 file with ffmpeg/libav?

I'm looking for a working and not-out-dated script how to record an e.g. rtsp input stream to a local file (mp4) with ffmpeg/libav. If you could point me to one or post one, many thanks in advance. I'm searching for many hours and I haven't got any experience with this topic.
A lot of examples, libs, etc. are outdated, but I want to use ffmpeg >= v3.3.
Any special things I have to consider (when compiling ffmpeg, or when saving local file to iOS device)?
Ffmpeg syntax is very straight forward.
ffmpeg [global_options] {[input_file_options] -i input_url} ... {[output_file_options] output_url} ...
So, if you don´t need to reencode or decode your RTPS video stream, you can simply run:
ffmpeg -i rtsp://your_stream_url your_file_name.format
Where format could be avi, mp4, flv or others, ffmpeg you automatic package your stream to the output file.
More information here.
https://www.ffmpeg.org/ffmpeg.html
Any special things I have to consider (when compiling ffmpeg, or when
saving local file to iOS device)?
Do you need to compile ffmpeg for an specific reason? I belive libav is enable on the executable you could download from the site.

Bento4 MP4Dash fails with audio?

I am running Bento4 Mp4Dash to convert my fragmented video files into MPEG-DASH streaming videos. However I seem to get this error
ERROR: unsupported input file, more than one "traf" box in fragment
but only if I have audio enabled. I have found that if I run -an in FFMPEG (to ignore the audio tracks) my MP4Dash command runs just fine, any ideas as to why this would happen?
I solved the problem by telling ffmpeg to extract the audio from the file I wanted to convert to DASH. Here is my solution in case someone still needs them.
extract audio
generate second video file with no audio
tell Bento4 Mp4Dash to use the video and the audio
For all steps there are tons of explainations how to do it on the internet. Here are some I found:
extract audio with the -vn flag, ffmpeg to extract audio from video
video without audio with the -an flag, Remove audio from video file with FFmpeg
tell Bento4 to use them each by following the advice in the official Usage documentation, section Advanced usage: add both the video and audio file as input and add [type=video] before the video and [type=audio] before the audio file (no space in between)

Getting exact time-stamp appended to the file from ffmpeg process

I am trying to capture frames using ffmpeg from a stream of video , which i am saving locally to my folder,
I need to know the exact time-stamp at which the frame is being captured
what i have tried so far is :
ffmpeg -i rtsp://ipaddress/axis-media/media.amp?camera=1 -an -vf showinfo %10d.jpg 2> res.txt
which i got from the source :
get-each-frame-time-stamp
this works fine too, the res.txt contains the time-elapsed of each frame since ffmpeg started(if my understanding is not wrong) ,
What i need is to get this time appended to the image files names which are being created or some other ways so that time-stamp information could be stored within the image.
any kind of help would be really appreciated .

qt-faststart command never finish

I am trying to use qt-faststart on MP4 videos to make the streaming fast but the qt-faststart command is never get finish, It is running from the last one and half hour and video file is of 14MB only.
qt-faststart file.mp4 newfile.mp4
The command is showing the ftyp and free as output
the output look like this and it is keep repeating these lines and increasing the number
ftyp 2324322 32
free 2324456 8
and the number is keep increasing with the output. No error is shown.
The MP4 video is converted from FLV video using the FFMPEG.
Generally it show the output like this but with my installation of qt-faststart I never get this ouput
patching stco atom...
patching stco atom..
writing ftyp atom...
writing moov atom...
copying rest of file ...
What could be the issue?
Is there anything wrong with the installation of qt-faststart?
I am on Linux 2.6.18-128.2.1.el5PAE i686
Check your paths to the files.
This works for me.
C:\Users\name\Desktop\qt-faststart.exe C:\Users\name\Desktop\videos\video.mp4 C:\Users\name\Desktop\videosnewer\video.mp4
Use the python wrapper https://github.com/danielgtaylor/qtfaststart
For more info, read “Server Crash” section here http://www.stoimen.com/blog/2010/11/12/how-to-make-mp4-progressive-with-qt-faststart/

Resources