1 year ago

#372596

test-img

Mohammad Umar

I am trying to record chunks of video from a camera stream using ffmpeg, but clips are recorded in h264 bitstream instead of annexb(avc1) bitstream

I am using the following command

ffmpeg -framerate 30 -video_size 1280x720 -input_format h264 -i /dev/video2 -c copy -strftime 1 -hls_flags second_level_segment_index -hls_init_time 3 -flags -global_header -f hls -bsf:v h264_mp4toannexb -hls_time 3 -hls_segment_filename 'c_%Y-%m-%dT%H:%M:%S_%%06d.mp4' out.m3u8

I have the requirement that bitstream should be avc1, but I have to run separate FFmpeg command to convert the recorded video slice to avc1

ffmpeg -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264

For this, I have to wait for the conversion

How should I modify the first FFmpeg command so that I get avc1 bitstream video slices?

ffmpeg -framerate 30 -video_size 1280x720 -input_format h264 -i /dev/video2 -c copy -strftime 1 -hls_flags second_level_segment_index -hls_init_time 3 -flags -global_header -f hls -bsf:v h264_mp4toannexb -hls_time 3 -hls_segment_filename 'c_%Y-%m-%dT%H:%M:%S_%%06d.mp4' out.m3u8

and

ffmpeg -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264

Getting this (h264)

I need avc1 bitstream

Desired bitstream (avc1)

ffmpeg

http-live-streaming

libavcodec

0 Answers

Your Answer

Accepted video resources