Opened 5 years ago

Closed 5 years ago

#4101 closed defect (invalid)

segment option creates continually longer files

Reported by: illumilore Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When running:
./ffmpeg -f video4linux2 -input_format mjpeg -s 960x720 -r 5 -strict -2 -i /dev/video0 http://127.0.0.1:8090/cam.ffm -map 0 -f segment -segment_time 60 -r 5 -s 640x480 /media/cam/testing_%04d.avi

the video files it creates will start to become longer videos than the 60 seconds that they each should be according to segment. When opening testing_0010.avi with vlc for example, it will be 11 minutes long, with the first 10 minutes consisting of the same frame. and then the 0011 file will have 11 minutes of the same image before actual video movement starts happening.

$ ./ffmpeg -f video4linux2 -input_format mjpeg -s 960x720 -r 5 -strict -2 -i /dev/video0 http://127.0.0.1:8090/cam.ffm -map 0 -f segment -segment_time 60 -r 5 -s 640x480 /media/cam/testing_%04d.avi
ffmpeg version N-67516-g8c28a39 Copyright (c) 2000-2014 the FFmpeg developers

built on Nov 10 2014 17:34:19 with gcc 4.8 (SUSE Linux)
configuration:
libavutil 54. 11.100 / 54. 11.100
libavcodec 56. 12.100 / 56. 12.100
libavformat 56. 12.103 / 56. 12.103
libavdevice 56. 2.100 / 56. 2.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100

Input #0, video4linux2,v4l2, from '/dev/video0':

Duration: N/A, start: 117967.621236, bitrate: N/A

Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 960x720, 0 kb/s, 5 fps, 5 tbr, 1000k tbn, 1000k tbc

[swscaler @ 0x19977e0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x19d4840] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x19f1120] deprecated pixel format used, make sure you did set range correctly
Output #0, ffm, to 'http://127.0.0.1:8090/cam.ffm':

Metadata:

creation_time : now
encoder : Lavf56.12.103
Stream #0:0: Video: flv1 (flv), yuv420p, 960x720, q=5-15, 4000 kb/s, 5 fps, 1000k tbn, 5 tbc
Metadata:

encoder : Lavc56.12.100 flv

Stream #0:1: Video: mjpeg, yuvj422p(pc), 960x720, q=1-5, 200 kb/s, 5 fps, 1000k tbn, 5 tbc
Metadata:

encoder : Lavc56.12.100 mjpeg

Stream #0:2: Video: mjpeg, yuvj422p(pc), 480x320, q=1-5, 200 kb/s, 5 fps, 1000k tbn, 5 tbc
Metadata:

encoder : Lavc56.12.100 mjpeg

Output #1, segment, to '/media/cam/testing_%04d.avi':

Metadata:

encoder : Lavf56.12.103
Stream #1:0: Video: mpeg4, yuv420p, 640x480, q=2-31, 200 kb/s, 5 fps, 5 tbn, 5 tbc
Metadata:

encoder : Lavc56.12.100 mpeg4

Stream mapping:

Stream #0:0 -> #0:0 (mjpeg (native) -> flv1 (flv))
Stream #0:0 -> #0:1 (mjpeg (native) -> mjpeg (native))
Stream #0:0 -> #0:2 (mjpeg (native) -> mjpeg (native))
Stream #0:0 -> #1:0 (mjpeg (native) -> mpeg4 (native))

Press [q] to stop, ? for help
[mjpeg @ 0x19c3120] rc buffer underflow

Last message repeated 1 times

[mjpeg @ 0x19c6540] rc buffer underflow
[mjpeg @ 0x19c3120] rc buffer underflow

Change History (5)

comment:1 Changed 5 years ago by cehoyos

I suspect you either have to use another container than avi or specify -reset_timestamps 1.

comment:2 Changed 5 years ago by illumilore

Reset timestamps does work, although I am confused as to why it would be container specific or why resetting it would not be the default behaviour.

comment:3 follow-up: Changed 5 years ago by illumilore

Also, where do I find documentation on the "%04d" part of my command?

https://ffmpeg.org/ffmpeg-all.html#Examples-10 says I can use something to the effect of "-f avi "/media/cam/%Y-%m-%d/%H%-%M.avi"" to get the output file to have date and time as it's name, but that just seems to interpret the percent sign literally.

comment:4 in reply to: ↑ 3 Changed 5 years ago by cehoyos

Replying to illumilore:

https://ffmpeg.org/ffmpeg-all.html#Examples-10

This is an example for the image2 muxer, you are using the segment muxer.

comment:5 Changed 5 years ago by illumilore

  • Resolution set to invalid
  • Status changed from new to closed

Yes, but in the segment part of the docs, it says "Output filename pattern can be set in a fashion similar to image2" so I was hoping that the strftime option would work as well.

I also see that timestamp is supposed to default to 0 as well there so I guess this isn't a bug.

Note: See TracTickets for help on using tickets.