3

I am using ffmpeg to get the image from several video files. I got my ffmpeg codes ready but I got the following error when I exec my codes.

ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr  2 2013 17:02:36 with gcc 4.6.3

*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
//files info...
//files info...
Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting format 'yuvj420p'
//file info...
[buffer @ 0x1513c40] Buffering several frames is not supported. Please consume all available frames before adding a new one.
 Last message repeated 75 times
[image2 @ 0x1513460] Could not open file : /test/project
av_interleaved_write_frame(): Input/output error

I only show the error messages that have color highlighted. My code:

 $ffmpeg ="/usr/bin/ffmpeg";

 $image_source_path = '/test/project/test.mp4';
 $ALL_PLACE_WIDTH = 300;
 $ALL_PLACE_HEIGHT = 300;

 $image_cmd = " -r 1 -ss 00:00:10 -t 00:00:01 -s ".$ALL_PLACE_WIDTH."x".$ALL_PLACE_HEIGHT."   -f image2 " ;

 $dest_image_path = '/test/project';

 $str_command= $ffmpeg  ." -i " . $image_source_path . $image_cmd .$dest_image_path;
 shell_exec($str_command);

It seems my Linux wants to me to switch to avconv. I am not sure how to fix these errors. Can someone give me a hint about it?

0

3 Answers 3

6

You should always show the full output and not cut out parts. In your example, the error would have been more apparent if you showed the actual ffmpeg command line that was executed instead of the whole PHP code around it.

In your case, your problem is that the command looks like:

ffmpeg -i /test/project/test.mp4 -r 1 -ss 00:00:10 -t 00:00:01 -f image2 /test/project

However, /test/project is a folder, and not a valid output image path. You can use /text/project/image%04d.jpg if you want images being created from image0001.jpg onwards.

If you real goal is to just export one thumbnail, use the vframes option:

ffmpeg -i /test/project/test.mp4 -r 1 -ss 00:00:10 -vframes 1 /test/project/image.jpg

In newer ffmpeg, you can use -frames:v as well.


You can use the ffmpeg in Ubuntu, but it's an old version. You can either use avconv from Libav or the original ffmpeg from FFmpeg — I would recommend compiling it from source.

Sign up to request clarification or add additional context in comments.

Comments

2

I encounter the same problem, and in my case I had wrong filename (for example 00:00:00.png) so its basically a OS limitation not ffmpeg's Hope this helps

Comments

0

A lot of the problems I’m seeing with these issues is due to wrong filename. Perhaps you formatted it wrong. Sliced it wrong or modified it is some manner that makes it an invalid path.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.