Record fragments of 10 seconds using FFMPEG and DSHOW from webcam

6,198

Try this:

ffmpeg -f dshow -framerate 15 -i video="USB Video Device":audio="Microphone (USB Audio Device)" -s 640x360 -c:v libx264 -g 15 -c:a aac -preset veryfast -segment_time 10 -segment_wrap 24 -f segment %03d.ts

The segment wrap, which I have carried over from your trial command, will overwrite existing files once the limit is reached. So, once 24 segments are generated, the 25th segment will be stored in the file containing the first segment (overwriting it) and so on. Remove this parameter if you don't want this behaviour.

Share:
6,198

Related videos on Youtube

MM PP
Author by

MM PP

Updated on September 18, 2022

Comments

  • MM PP
    MM PP over 1 year

    I am a beginner of FFMPEG. I solved to record my webcam 10 seconds. I need to make recordings of 10 seconds each and I don't know how can I do this.

    ffmpeg -f dshow -video_size 640x360 -framerate 15 -t 00:00:10 -i video="USB Video Device":audio="Microphone (USB Audio Device)" 1.mp4
    

    So, I don't need to make a full recording. I need to make recordings of 10 seconds each, continuously until press stop or something else.

    Thank you for helping me so much!

    EDIT I just found this:

    ffmpeg -i rtmp://INPUT -codec copy -f segment -segment_list out.list -segment_time 3600 -segment_wrap 24 out%03d.mp4
    

    I changed to:

    ffmpeg -f dshow -video_size 640x360 -framerate 15 -i video="USB Video Device":audio="Microphone (USB Audio Device)" -segment_time 3600 -segment_wrap 24 out%03d.mp4
    

    but it doesn't work. Please help me!