James Taylor
James Taylor

Reputation: 6258

ffmpeg copy stream preserving FPS

I have a stream that I know is outputting at a certain frame rate (30 FPS). I want to use ffmpeg to make a copy of this stream and save it to disk.

I have the following command:

ffmpeg -i http://input/ -c copy -map 0 \
    -f segment -strftime 1 -segment_time 900 \
    -segment_atclocktime 1 -segment_format mp4 %Y-%m-%d_%H-%M-%S.mp4

But when I run the command, I see the following:

frame=   32 fps=3.9 q=-1.0 Lsize=N/A time=00:00:01.27 bitrate=N/A

Where it appears the FPS is hovers around ~4.0 FPS and time moves slower than real time.

I tried added -re (copy the rate of the input stream) and -r 30 (manually set the rate to 30 FPS) flag specified before the input file, but it didn't seem to work.

I also read a similar question here using -framerate 30, but that option doesn't exist in the man pages and is an Invalid option.

Any help would be greatly appreciated!


So I let the modified command (removing the flags -c copy -map 0) run for exactly 5 minutes. Running ffprobe yields:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2017-03-10_01-09-12.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.2.100
  Duration: 00:00:15.43, start: 0.066016, bitrate: 13416 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1024x768, 13414 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler

Again, this only produces 15 seconds of video and I can't seem to get a 1:1 relationship between the input stream of 30 FPS and an output stream also in 30 FPS in real time. Playing the video yields something that's sped up.

Upvotes: 1

Views: 3768

Answers (1)

Gyan
Gyan

Reputation: 93018

That's the processing speed i.e. 4 frames processed per second. It's not the output stream FPS. In any case, in stream copy mode, FFmpeg cannot alter output FPS, unless your input is a raw bitstream.

Upvotes: 1

Related Questions