Den 13.06.2025 21:38, skrev Andrew Randrianasulu:


пт, 13 июн. 2025 г., 22:23 Phyllis Smith <[email protected]>:

    With the patch (and even using extension of mpeg instead of seg),
    I simply have not been able to get this to work.  So either I keep
    doing something wrong or it does.  Patch to fileffmpeg.C is:
    0001-Fixup-seg-name-to-segment-so-format-gui-button-work.patch . 
    And the 2 presets are  bluray_lpcm.seg  and mpeg2hd422p.seg


Try extension mpg, not mpeg and be sure you have

%d0 symbols in your filename?

Note, this file will be created as 0-sized, you need to watch/load segment files manually.

......................... snip


                                    >>
                                    >> пт, 30 мая 2025 г., 00:30
                                    Andrew Randrianasulu
                                    <[email protected]>:
                                    >>
                                    >> чт, 29 мая 2025 г., 23:42 Terje
                                    J. Hanssen via Cin
                                    <[email protected]>:
                                    >>
                                    >> Is it possible with CinGG's
                                    Record utility (via FFMPEG) to
                                    record a stream to file segments
                                    of same duration or file size and
                                    use auto-naming?
                                    >>
                                    >> Typical example:
                                    >> Record a video/audio input
                                    stream (i.e from playing a
                                    camcorder tape cassette) and
                                    encode to output file segments of
                                    10 minutes or 10 GB each and
                                    auto-name file numbers.
                                    >>
                                    >> Similar example code using an
                                    input file instead at
                                    >>
                                    
https://unix.stackexchange.com/questions/1670/how-can-i-use-ffmpeg-to-split-mpeg-video-into-10-minute-chunks
                                    >>
                                    >> Just use what is built into
                                    ffmpeg to do exactly this.
                                    >>
                                    >> ffmpeg -i invid.mp4 -threads 3 \
                                    >>   -vcodec copy -f segment
                                    -segment_time 10:00 \
                                    >> -reset_timestamps 1 \
                                    >> cam_out_h264_%02d.mp4
                                    >>
                                    >> This will split it into roughly
                                    10-minute chunks, split at the
                                    relevant keyframes, and will
                                    output to the files
                                    cam_out_h264_01.mp4,
                                    cam_out_h264_02.mp4, etc.
                                    >>
                                    >> Very interesting question!
                                    Never tried this, did not even
                                    know it existed!
                                    >>
                                    >> As long as this -f just
                                    ordinary avformat muxer you
                                    probably can copy your favourite
                                    ffmpeg video/audio profiles with
                                    new .seg name and put "segmented"
                                    at very first line there , where
                                    "mov" or "matroska" or other
                                    format name was, and add rest of
                                    options. And add pattern (%02d)
                                    into name just as with
                                    ffmpeg-based image lists.
                                    >>


............snip

I went to the start and successful adapted the ffmpeg codeline for capturing mpeg2sd422p via v4l2 to segments 'a 30 sec, total time 120 sec:

ffmpeg -hide_banner -f v4l2 -video_size 720x576 -framerate 50 -i /dev/video0 -f alsa -ch_layout stereo -i hw:CARD=UHD,DEV=0 -c:v mpeg2video -vf scale=720x576 -profile:v 422p -level:v main -refs 1 -bf 2 -b:v 30M -maxrate 30M -minrate 30M -bufsize 25M -muxrate 35M -c:a pcm_s16le -t 120 -f segment -segment_time 00:30 -reset_timestamps 1 mpeg2sd422p_30M_%02d.mkv

Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 139.588942, bitrate: 331776 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 720x576, 331776 kb/s, 50 fps, 50 tbr, 1000k tbn
Input #1, alsa, from 'hw:CARD=UHD,DEV=0':
  Duration: N/A, start: 1750676281.517256, bitrate: 1536 kb/s
  Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg2video (native))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[mpeg2video @ 0x55d2ea6dd6c0] Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!
[segment @ 0x55d2ea6f1840] Opening 'mpeg2sd422p_30M_00.mkv' for writing

Output #0, segment, to 'mpeg2sd422p_30M_%02d.mkv':
  Metadata:
    encoder         : Lavf61.7.100
  Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, progressive), 720x576, q=2-31, 30000 kb/s, 50 fps, 1k tbn
      Metadata:
        encoder         : Lavc61.19.101 mpeg2video
      Side data:
        cpb: bitrate max/min/avg: 30000000/30000000/30000000 buffer size: 25000000 vbv_delay: N/A
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
      Metadata:
        encoder         : Lavc61.19.101 pcm_s16le
[segment @ 0x55d2ea6f1840] Opening 'mpeg2sd422p_30M_01.mkv' for writing.999x
[segment @ 0x55d2ea6f1840] Opening 'mpeg2sd422p_30M_02.mkv' for writing  1x
[segment @ 0x55d2ea6f1840] Opening 'mpeg2sd422p_30M_03.mkv' for writing  1x
[out#0/segment @ 0x55d2ea6f6b00] video:438690KiB audio:22499KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown frame= 6000 fps= 50 q=2.5 Lsize=N/A time=00:01:59.98 bitrate=N/A dup=0 drop=1 speed=   1x

----------

du -sh mpeg2sd422p_30M_*
113M    mpeg2sd422p_30M_00.mkv
113M    mpeg2sd422p_30M_01.mkv
113M    mpeg2sd422p_30M_02.mkv
114M    mpeg2sd422p_30M_03.mkv

-----------

ffprobe -hide_banner mpeg2sd422p_30M_02.mkv
Input #0, matroska,webm, from 'mpeg2sd422p_30M_02.mkv':
  Metadata:
    ENCODER         : Lavf61.7.100
  Duration: 00:00:30.02, start: 0.000000, bitrate: 31548 kb/s
  Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, progressive), 720x576 [SAR 1:1 DAR 5:4], 50 fps, 50 tbr, 1k tbn
      Metadata:
        ENCODER         : Lavc61.19.101 mpeg2video
        DURATION        : 00:00:30.020000000
      Side data:
        cpb: bitrate max/min/avg: 30000000/0/0 buffer size: 25001984 vbv_delay: N/A
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
      Metadata:
        ENCODER         : Lavc61.19.101 pcm_s16le
        DURATION        : 00:00:30.000000000

------------

ffprobe -hide_banner mpeg2sd422p_30M_03.mkv
Input #0, matroska,webm, from 'mpeg2sd422p_30M_03.mkv':
  Metadata:
    ENCODER         : Lavf61.7.100
  Duration: 00:00:30.06, start: 0.000000, bitrate: 31550 kb/s
  Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, progressive), 720x576 [SAR 1:1 DAR 5:4], 50 fps, 50 tbr, 1k tbn
      Metadata:
        ENCODER         : Lavc61.19.101 mpeg2video
        DURATION        : 00:00:30.059000000
      Side data:
        cpb: bitrate max/min/avg: 30000000/0/0 buffer size: 25001984 vbv_delay: N/A
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
      Metadata:
        ENCODER         : Lavc61.19.101 pcm_s16le
        DURATION        : 00:00:30.059000000





-- 
Cin mailing list
[email protected]
https://lists.cinelerra-gg.org/mailman/listinfo/cin

Reply via email to