Take the 2-minute tour ×
Video Production Stack Exchange is a question and answer site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation. It's 100% free, no registration required.

I'm attempting to extract the individual frames from a raw AVC video stream. I'm doing this via the following ffmpeg command: ffmpeg -q 1 -i video_test.avc -f image2 frames/frames_%04d.jpg

The problem I'm encountering is the first few frames look good. I'm including an example below. Example of good frame

The extracted frames then get progressively worse and by the time I get to the 17th frame, they're really blocky. Example of blocky image

You get get the raw video from this link.

Is there an option I'm missing? I've noticed that FFMPEG on my Mac works as expected and generates nice frames, but FFMPEG on my production server that runs Ubuntu exhibits this problem.

share|improve this question
    
Does it improve each time a keyframe is reached or does it continue to get worse indefinitely? –  AJ Henderson Aug 5 '13 at 16:16
    
Once it gets to the blocky state, it stays at that blocky state indefinitely. It doesn't get worse. –  CadentOrange Aug 5 '13 at 16:54
    
Have you tried different versions of FFMPEG to see if it is just a bug in the particular version? Sorry, just throwing out random troubleshooting thoughts. I'm not aware of anything specific to this problem. –  AJ Henderson Aug 5 '13 at 16:56
    
I'm using the binaries from the repository listed on ffmpeg.org/download.html. This gets updated somewhat frequently and the last update was on July 15th. I'll try building it from source tomorrow and see if that changes anything. –  CadentOrange Aug 5 '13 at 18:59
add comment

1 Answer 1

up vote 2 down vote accepted

Option placement matters

Is there an option I'm missing?

No, but option placement matters. Options before the input apply to the input, and options before the output generally apply to the output. The exception are global options. See the FFmpeg synopsis and FFmpeg description for more details on option placement.

Therefore, you must move your -q (alias for -qscale) option:

ffmpeg -i video_test.avc -q:v 2 frames/frames_%04d.jpg
  • -f image2 is superfluous here since ffmpeg knows that your outputs are images.
  • A sane range for -q:v for the encoder mjpeg is 2-5; lower is higher quality.
  • It is recommended to be explicit as to which stream you want to apply -q to since ffmpeg can not know if it should be applied to video or audio, so in your case use -q:v. This is good practice, although it does not matter for your input since you have no audio.

A fake "ffmpeg"

I've noticed that FFMPEG on my Mac works as expected and generates nice frames, but FFMPEG on my production server that runs Ubuntu exhibits this problem.

Ubuntu no longer uses FFmpeg:

Since I do not use the fork my answer may not work for you.

Getting ffmpeg

FFmpeg development is very active and it is always a good idea to use a recent version. Two main ways of getting it are:

share|improve this answer
    
It was the placement of the -q 1 that did it. Thanks. –  CadentOrange Aug 5 '13 at 20:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.