<p>You're outputting to a raw bitstream. Usually, you want to output to a container like <code>.mp4</code>, <code>.mov</code> or <code>.mkv</code>.</p>

<p>H.264 raw bitstreams have no index and individual frames have no timestamps (PTS/DTS). The definitive way to estimate the duration is by counting the frames and dividing by the frame rate. Of course, this only holds for streams to be shown at a constant framerate.</p>

CC BY-SA 3.0
2016-11-03T16:18:04.957Z
I appreciate the comment. In this case I am intentionally omitting a container because I am feeding the raw stream to an internal system that normally receives data from live cameras, and which is designed to work with H264 streams without containers.
Phrogz
CC BY-SA 3.0
2016-11-03T16:26:44.353Z
I haven't seen a (ffmpeg-produced) H264 bitstream with duration since there's no global index or timestamps. At best you can count frames with ffprobe, and divide by the framerate.
Gyan
CC BY-SA 3.0
2016-11-03T16:16:29.347Z
2016-11-03T16:31:50.650Z
2016-11-03T16:31:50.650Z
Gyan
<p>I have a sequence of PNG files (3D renders) that I want to encode as an H.264 video @ 30fps.</p>

<p>I'm using the following command (I happen to be compositing a background under the renders):</p>

<pre><code>ffmpeg -loop 1 -i bg.jpg -r 30 -i renders/frame_%04d.png -c:v libx264 -preset veryfast \
       -profile:v main -filter_complex overlay -shortest -r 30 -pix_fmt yuv420p -t 16 \
       video.h264
</code></pre>

<p>The resulting video plays in VLC, but I can't seek properly (always corrupts like no keyframes), it shows no duration, and it shows no elapsed time as it plays.</p>

<p>If I use <code>ffprobe</code> to analyze the result, I see this:</p>

<pre><code>$ ffprobe video.h264 
ffprobe version N-81995-gd790e48 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc
  libavutil      55. 32.100 / 55. 32.100
  libavcodec     57. 61.103 / 57. 61.103
  libavformat    57. 52.100 / 57. 52.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 64.100 /  6. 64.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  2.100 /  2.  2.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, h264, from 'surround-view_front.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p, 1920x1208, 30 fps, 30 tbr, 1200k tbn, 60 tbc
</code></pre>

<p>Why does that show <code>Duration: N/A, bitrate: N/A</code>, and how do I fix it?</p>

<ffmpeg><h.264>
H.264 produced by ffmpeg from images has no duration
Phrogz
# H.264 produced by ffmpeg from images has no duration

(Asked by: username_0 on 2016-11-03)

I have a sequence of PNG files (3D renders) that I want to encode as an H.264 video @ 30fps.
I'm using the following command (I happen to be compositing a background under the renders):
ffmpeg -loop 1 -i bg.jpg -r 30 -i renders/frame_%04d.png -c:v libx264 -preset veryfast \
       -profile:v main -filter_complex overlay -shortest -r 30 -pix_fmt yuv420p -t 16 \
       video.h264

The resulting video plays in VLC, but I can't seek properly (always corrupts like no keyframes), it shows no duration, and it shows no elapsed time as it plays.
If I use ffprobe to analyze the result, I see this:
$ ffprobe video.h264 
ffprobe version N-81995-gd790e48 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc
  libavutil      55. 32.100 / 55. 32.100
  libavcodec     57. 61.103 / 57. 61.103
  libavformat    57. 52.100 / 57. 52.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 64.100 /  6. 64.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  2.100 /  2.  2.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, h264, from 'surround-view_front.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p, 1920x1208, 30 fps, 30 tbr, 1200k tbn, 60 tbc

Why does that show Duration: N/A, bitrate: N/A, and how do I fix it?

**Tags:** ffmpeg, h.264


---

## 1 answers

### Answer by username_1 on 2016-11-03. Score: 1 | Accepted answer

You're outputting to a raw bitstream. Usually, you want to output to a container like `.mp4`, `.mov` or `.mkv`.

H.264 raw bitstreams have no index and individual frames have no timestamps (PTS/DTS). The definitive way to estimate the duration is by counting the frames and dividing by the frame rate. Of course, this only holds for streams to be shown at a constant framerate.

> **Comments:**
> **username_0**: I appreciate the comment. In this case I am intentionally omitting a container because I am feeding the raw stream to an internal system that normally receives data from live cameras, and which is designed to work with H264 streams without containers.  
> **username_1**: I haven't seen a (ffmpeg-produced) H264 bitstream with duration since there's no global index or timestamps. At best you can count frames with ffprobe, and divide by the framerate.  

---

