How to fix "moov atom not found" when extracting an image from partial video mp4 file? - image

I think the problem is relatively common, but I can't find any good solution to my problem.
Well, I need to create a preview of the video while it uploads. It can be a very big video, so I decided to use only the first 10 Mb of video to make image extraction with ffmpeg.
The command-line looks like this
ffmpeg -ss 00:00:00 -i "src.mp4" -frames:v 1 -q:v 2 "preview.jpg"
It works fine for lots of video files, but for mp4 it always failed with the error message "Moov atom not found". I guess the mp4 format is not streamable and the cut file looks like a broken video for the FFmpeg.
But there should be a solution to this. Could you help me?

Related

Is there any way to get the exact audio .wav from a .mp4 video? (same length and same duration)

I extracted .wav files from many short mp4 videos. (3-6 seconds) But the extracted xxx.wav can not be aligned with .mp4 videos in Premiere. Some videos are 1 frame, and some 2 frames behind.
I used ffmpeg as the following command line:
ffmpeg -i xxx.mp4 xxx.wav
I tried -async or -vsync, but not worked. Here is an example:
1 frame shift
Here is the source mp4 and the extracted wav:
https://drive.google.com/drive/folders/1BFS0JLCPqA3YDMIahlorXTaRTFTJaPfU?usp=share_link
Do you know what caused the problem? Is there any way to get the exact audio .wav from a .mp4 video? (Aligned with frame level) Thank you very much.

ffmpeg: concatenating mp4 files. Video freezes for few seconds on first frame on output mp4

I created several MP4 files using ffmpeg. All of the videos have same settings and codec. Only difference is frames per second and duration. I then concatenated the videos using command below.
ffmpeg -f concat myList.txt -c copy output.mp4
I notice that when launching/opening the output.mp4 file in windows media player, it stops/freezes on the first frame of the video for about three four seconds and then starts playing, rest of the videos has correct fps and runs smoothly. Has anyone encountered this issue. I would like the video to start as soon as it is launched. Any suggestions to mitigate this issue?
Update: So far, I have found that the video length is exactly what I expect it to be.
ffprobe -i output.mp4
When i ffplay the video, it runs smoothly, but when I use windows media player, it gets stuck in first frame for about 4-5 seconds then plays smoothly. So I am going to assume that this issue is related to media players (buffers/loading before playing). Can't be sure though.
I solved this problem by converting my input files to avi and resizing them to the same size.
And then run
ffmpeg -i "concat:file1.avi|file2.avi|" -c copy out.avi

drag and drop conversion with FFMPEG in multiple formats

i'm looking for a script that can convert a video in 2 formats for my website :
mp4 and Webm
i also want it to create a jpeg of the first frame and make all at 640*360
I'm a begginer with ffmpeg so i don't really know where to start. this is what i have for the moment, but that doesn't work
ffmpeg -i /tmp/video.off /tmp/video.webm /tmp/video.mp4
the ideal situation is to have a drag and drop conversion tool, but a folder based can do the trick too
Thank you

ffmpeg GIF to WebM decoding issue

I'm trying to convert GIF files into WebM (ffmpeg, libvpx) and getting some strange ffmpeg behaviour.
ffmpeg is installed on my mac from MacPorts.
Converting with:
ffmpeg -i srcFilename.gif -b:v 600K -qmin 0 -qmax 50 -crf 5 destFilename.webm
if my GIF file has some frame(s) with 1-2s duration somewhere in the middle of animation like this, conversion result is fine - it's playing with the "pause" in the middle.
But if I have GIF like this with "pause" in the last frame, ffmpeg decodes it without a delay.
Have no idea why, spent some time reading ffmpeg manual, trying different conversion options with no success.
Any ideas? Thanks in advance!
I wrote an email to GIF decoder author and he answered me that he knows about this issue. It's located somewhere deep inside of ffmpeg and he has no idea how to fix it right now.
So, I'm using "dirty hack" in my project - just adding copy of last frame with zero delay to GIF file before encoding.

FFmpeg Images to Video and Streaming

I've a C# program generating JPEG images in realtime, i need to (continuously) generate a video from the images and stream it (also in realtime).
I've used ffmpeg to transcode an input video source and stream it, doesn't ffmpeg have an option to get the input as a set of images(always being generated) and make the video out of it ?
Cheers
Actually I used VLC for the streaming....
Actually I just found at that I could:
ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg
But i need to tell ffmpeg to keep doing it, I mean, if it doesn't find another image ffmpeg should wait for another one to be generated... is this possible ?

Resources