Deepak Nellurvalappil
Deepak Nellurvalappil

Reputation: 71

ffmpeg segment muxer produces unplayable HEVC video outputs

I am trying to process streaming video data from a usb webcam using ffmpeg. the process involves encoding the raw data into hevc format. Up to this point I am able to do. But now, I want to slice the processed data in chunks of 10 seconds and save it in a separate file. This should repeat until I kill/interrupt the process manually.

ffmpeg -i /dev/video1 -f segment -segment_times 10 -c:v hevc cam_1_%02d.mp4

the above code does create multiple files but only the first file is readable using vlc; other files look corrupt.

And while I was running the command, I could see the following messages:-

Stream mapping:  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264)) Press [q] to stop, [?] for help Past duration 0.601555 too largeN/A time=00:00:14.63 bitrate=N/A dup=11 drop=0      Past duration
0.601463 too large Past duration 0.601555 too largeN/A time=00:00:15.16 bitrate=N/A dup=11 drop=0     Past duration 0.601585 too large
    Last message repeated 1 times Past duration 0.601646 too large Past duration 0.601677 too large Past duration 0.601707 too largeN/A time=00:00:15.66 bitrate=N/A dup=11 drop=0

What am I missing here?

Upvotes: 1

Views: 1041

Answers (1)

llogan
llogan

Reputation: 133983

Add the -reset_timestamps 1 output option. From the segment muxer documentation:

Reset timestamps at the beginning of each segment, so that each segment will start with near-zero timestamps. It is meant to ease the playback of the generated segments. May not work with some combinations of muxers/codecs. It is set to 0 by default.

Also, consider changing -segment_times to -segment_time because you are a single time value.

Upvotes: 1

Related Questions