[FFmpeg-user] ffmpeg sometimes does not properly close the file

Cley Faye cleyfaye at gmail.com
Tue Mar 20 17:22:49 EET 2018


2018-03-20 16:16 GMT+01:00 rbfmpg29 at t-online.de <rbfmpg29 at t-online.de>:

> I do a screencast with ffmpeg. The call looks like
> ffmpeg -f x11grab -video_size 800x600 -framerate 25 -i :2 -c:v libx264
> -pix_fmt yuv420p -preset ultrafast test.mp4
>
> The screencast is stopped by a SIGTERM (15) signal to the
> ffmpeg process. In most cases, this works fine.
> Occasionally, the ffmpeg process does not properly write
> the trailer to the file. Then the file is unusable.
>
>


> I have the following questions:
> 1. Does anyone know these exit codes, and in
>     particular, does this give us a hint, what is
>     going wrong?
>

​You might want to/should/must post the complete output from ffmpeg here.
If there's any hint at something going wrong, it will be in this log. It
will also provide information about what you requested, what ffmpeg
understood, what it saw, etc.​




> 3. Is it possible to repair the file? I corrupted a
>     file by cutting off some kilobytes from a healthy
>     mp4 file and tried to repair it with ffmpeg  copy.
>     However, I get an error about an unprocessable
>     file.


​MP4 files are not good at this. Some tools pretend to be able to fix such
broken files, but this is not very reliable. If possible, use another, more
fault-tolerant container such as mkv or even avi.​


More information about the ffmpeg-user mailing list