Ffmpeg Codec Frame Size Is Not Set

  

You can set the values between 0 and 51, where lower values would result in better quality (at the expense of higher file sizes). Sane values are between 18 and 28. The default for x264 is 23, so you can use this as a starting point. Since 3gp is a flexible container format, you have to give ffmpeg some parameters as video bitrate, frame size, video codec, audio bitrate, audio codec. For example, the following code extracted from a forum: ffmpeg -i input.flv -b 300k -s 320x240 -vcodec mpeg4 -ac 2 -ab 128k -acodec libfaac output.3gp.

Active1 month ago

I am following a tutorial on how to work with cinelerra-cv,in the very beginning it was said, that the very first stepin working with cinelerra, is to convert whatever video clipone has into the dnxhd format. It was just said, not explained how to do it.

After some research, I came across ffmpeg, but I have no idea how to use it with regard to dnxhd, with the little knowledge I gathered about ffmpeg, my guess how to do it would be:

Ffmpeg Change Size

however, this does not work, and the examples I have seen on converting into dnxhd with ffmpeg I do not understand, they seemed each time having some different tags without explaining why to use them.

Ffmpeg track 1 codec frame size is not setsharkantsharkant
5112 gold badges10 silver badges21 bronze badges

1 Answer

This is a picky encoder so you have to choose proper parameters including:

  • frame rate
  • pixel format / color space
  • width x height / resolution / frame size
  • bitrate

See the Valid DNxHD parameters below for accepted values.

This example will scale to 1280x720, choose a frame rate of 30000/1001 (aka '29.97'), and a pixel format of YUV 4:2:2 planar.

  • If your input file already conforms to some of the accepted parameters then you don't have to manually declare them.

  • Output format container for DNxHD is typically MXF or MOV.

DNxHR is for resolutions bigger than 1080p such as 2K, 4K, and 8K.

If you want DNxHR then add the -profile:v output option, such as -profile:v dnxhr_hq.

Accepted values are: dnxhd, dnxhr_444, dnxhr_hqx, dnxhr_hq, dnxhr_sq, dnxhr_lb.

  • DNxHR LB: dnxhr_lb - Low Bandwidth. 8-bit 4:2:2 (yuv422p). Offline Quality.
  • DNxHR SQ: dnxhr_sq - Standard Quality. 8-bit 4:2:2 (yuv422p). Suitable for delivery format.
  • DNxHR HQ: dnxhr_hq - High Quality. 8-bit 4:2:2 (yuv422p).
  • DNxHR HQX: dnxhr_hqx - High Quality. 10-bit 4:2:2 (yuv422p10le). UHD/4K Broadcast-quality delivery.
  • DNxHR 444: dnxhr_444 - Finishing Quality. 10-bit 4:4:4 (yuv444p10le). Cinema-quality delivery.

The above list was adapted from DNxHR codec.

ffmpeg will fail if you provide incorrect values, but it can provide a list of what is accepted.

You can show the list with the following 'dummy' command:

Important Notes about Frame Rate

  • Frame rate is missing from the list that is generated from this command. ffmpeg will blindly accept any frame rate for this encoder, and Avid software will reportedly accept it (unconfirmed), but the DNxHD bitrate is supposed to be matched to specific frame rates only. For maximum compatibility I recommended only using the proper bitrate/frame rate combination. So use the command above to get the proper bitrates and pixel formats accepted by ffmpeg, and cross reference with the List of Avid DNxHD resolutions or the DNxHD White Paper (page 9) for the proper frame rates.

  • The frame rates listed in the links above are using inaccurate rounded approximations. The proper values are listed below; the abbreviated name is to the left and the proper value is to the right.

    • 29.97 = 30000/1001 (or use the alias ntsc)
    • 59.94 = 60000/1001
    • 23.967 = 24000/1001 (or use the alias ntsc-film)

For additional encoder specific options, and a list of supported pixel formats, refer to:

This means that your frame rate, width, height, pixel format, and/or bitrate are incorrect. Refer to Valid DNxHD parameters above for accepted values.

pixel format is incompatible with DNxHD profile

Choose a proper pixel format using the format filter. See the DNxHD example above.

lloganllogan

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

Active4 months ago

I have video frames in PNG format at 1 FPS and I'm trying to convert them into a video using ffmpeg.

If I do something like this:

ffmpeg -i data/input-%4d.png data/output.mp4

I get a video at 25FPS which is basically a very fast-forward of the input (which is captured at 1FPS).

Set

If I try:

ffmpeg -i data/input-%4d.png -r 1 data/output.mp4

I get something that VLC doesn't want to play :)

Now, if I take the first video (the FF one) and apply a filter to slow it down (e.g. -filter:v 'setpts=24.0*PTS'), I can get it to play like a 1 FPS video, but of course the price is file size. It's generating a bunch of repeated frames I guess.

So, the question is how do I create a video that has exactly 1 FPS and actually plays at that speed? The output format, btw, isn't that important for me.

Assaf Lavie
Assaf LavieAssaf Lavie

4 Answers

If you want a one-liner for FFMPEG that generates a video that plays at 1 frame per second, what you want to do is specify framerates for both input and output, like this:

ffmpeg -r 1 -i data/input-%4d.png -pix_fmt yuv420p -r 10 data/output.mp4

The -r 1 means the video will play at 1 of the original images per second.
The -r 10 means the video will play at 10 frames per second.

(The -pix_fmt yuv420p is just there to ensure compatibility with a wide range of playback programs. It is required here, for example, for the video to be playable by Windows Media Player.)

I tested many different output framerates, and 10 seems to be the lowest number you can use that will still produce a video that VLC will play.

Of course, the command above means each original image is being multiplied, but it is a simpler method than the 'slow it down' one you mentioned, and depending on the codec it may not produce a video much larger than a true 1-FPS video.

To test this, I just produced a true 1-FPS video, which came out to 2.24 kiB. I then produced a video with the same input images but output at 24 FPS, and it came out to 5.76 kiB. That's just over double the size, and nowhere near 24 times the size. :)

A.M.A.M.

Use both -framerate and -r

E.g., to have a final video that looks like 1FPS:

This is similar to what Converting PNG frames to video at 1 FPS | Unix & Linux Stack Exchange says, but I needed -framerate instead of -r for it to work.

This is mentioned on the wiki at: http://trac.ffmpeg.org/wiki/Slideshow#Framerates

It sets the output framerate to 30, which VLC can handle, and copies each images 30 times, so that the output video appears to be at 1 FPS. See also: Playback issues in VLC with low fps video from images using ffmpeg | Stack Overflow

VLC is then able to play the video normally.

Tested on Ubuntu 16.10, VLC 2.2.4, ffmpeg 3.0.5, in a directory with 10 PNGs.

See also: https://stackoverflow.com/questions/19267443/vlc-freezes-for-low-1-fps-video-created-from-images-with-ffmpeg

Html Frame Size

Ciro Santilli 新疆改造中心996ICU六四事件Ciro Santilli 新疆改造中心996ICU六四事件
6,3602 gold badges54 silver badges51 bronze badges

What if you augment your second example slightly as follows:

The -r 1 needs to come before the .png files, not after.

From the FFmpeg documentation:

As a general rule, options are applied to the next specified file. Therefore, order is important, and you can have the same option on the command line multiple times. Each occurrence is then applied to the next input or output file.

Ffmpeg Track 1 Codec Frame Size Is Not Set

slmslm
267k74 gold badges578 silver badges725 bronze badges

This is a bug in VLC (which still exists in version 3.0.6). After some experiments I realized that VLC crashes for videos with FPS less than 10. So all videos with 10 FPS or more shouldn't be a problem. So there is currently no clean way to get a video with 1 FPS which is playable in VLC (don't give up, keep reading).

Frame Size Body

Not

One workaround is -as shown in the answer above- to fake the effect of 1 FPS by duplicating the images (when we actually have an FPS equals to 10 or more, which is ok for VLC).

Ffmpeg Codec Frame Size Is Not Set

Example: if you have a folder with 12 images, and you would like to generate a video with 1 FPS (which is playable in VLC), then you need to duplicate each image multiple times (let's say 10 times), and then tell FFMPEG to generate a 10 FPS video. In this way we will get a video with a total frames of 120, where each image will be played for 1 seconds (as it is duplicated 10 times), which is simply a fake for 1 FPS.

Ffmpeg Image Resolution

I prefer to use fps parameter rather than -r (which is shown in another answer) which may in some case be problematic (according to the official documentation).

As the input -framerate is lower than the output fps, FFMPEG will duplicate frames to reach your desired output frame rate (which is 10 according to the command above).

Ffmpeg Codec Frame Size Is Not Set

It is also important to notice that the order of -framerate and -vf fps is important, as this configuration will be applied to the next mentioned video (in- or output). That is according to the official docs:

options are applied to the next specified file. Therefore, order is important...

Mohammed NoureldinMohammed Noureldin

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