[FFmpeg-user] Anyone having success capturing hours of 4k video, reliably and with low loss, using ffmpeg?

Gabriel Balaich roderrooder at gmail.com
Wed Aug 8 22:38:34 EEST 2018


>
> Nice.  What codec and/or command line?
>
> Also if anybody's desperate for a "software" solution I might be able
> to provide a new video codec that "uses a lot of space but is
> screaming fast" let me know if x264 ultrafast isn't fast enough.
> Cheers!
>

Kind of a huge command:
 ffmpeg -loglevel error -stats -y -thread_queue_size 9999 -indexmem 9999
-guess_layout_max 0 -f dshow -rtbufsize 2147.48M ^
-i audio="Analog (3+4) (RME Fireface UC)" ^
-thread_queue_size 9999 -indexmem 9999 -guess_layout_max 0 -f dshow
-rtbufsize 2147.48M ^
-i audio="ADAT (3+4) (RME Fireface UC)" ^
-thread_queue_size 9999 -indexmem 9999 -guess_layout_max 0 -f dshow
-video_size 3840x2160 -rtbufsize 2147.48M ^
-framerate 120 -pixel_format nv12 -i video="Video (00 Pro Capture HDMI
4K+)":audio="Audio (00 Pro Capture HDMI 4K+)" ^
-thread_queue_size 9999 -indexmem 9999 -guess_layout_max 0 -f dshow
-video_size 1920x1080 -rtbufsize 2147.48M ^
-framerate 60 -pixel_format yuyv422 -i video="Game Capture HD60 Pro (Video)
(#01)":audio="ADAT (5+6) (RME Fireface UC)" ^
-thread_queue_size 9999 -indexmem 9999 -r 25 -f lavfi -rtbufsize 2147.48M
-i color=c=black:s=50x50 ^
-map 4,0 -map 0 -c:v libx264 -r 25 -rc-lookahead 50 -forced-idr 1
-strict_gop 1 -sc_threshold 0 -flags +cgop ^
-force_key_frames expr:gte(t,n_forced*2) -preset ultrafast -pix_fmt nv12
-b:v 16K -minrate 16K -maxrate 16K -bufsize 16k ^
-c:a aac -ar 44100 -b:a 384k -ac 2 -vf "fps=25" -af "aresample=async=250"
-vsync 1 -ss 00:00:02.456 ^
-max_muxing_queue_size 9999 -f segment -segment_time 600 -segment_wrap 9
-reset_timestamps 1 ^
-segment_format_options max_delay=0
C:\Users\djcim\Videos\PS4\Theirs\TPS%02d.ts ^
-map 4,1 -map 1 -c:v libx264 -r 25 -rc-lookahead 50 -forced-idr 1
-strict_gop 1 -sc_threshold 0 -flags +cgop ^
-force_key_frames expr:gte(t,n_forced*2) -preset ultrafast -pix_fmt nv12
-b:v 16K -minrate 16K -maxrate 16K -bufsize 16k ^
-c:a aac -ar 44100 -b:a 384k -ac 2 -vf "fps=25" -af "aresample=async=250"
-vsync 1 -ss 00:00:01.840 ^
-max_muxing_queue_size 9999 -f segment -segment_time 600 -segment_wrap 9
-reset_timestamps 1 ^
-segment_format_options max_delay=0
C:\Users\djcim\Videos\PS4\Soundboard\SPS%02d.ts ^
-map 2:0,2:1 -map 2:1 -c:v h264_nvenc -r 60 -rc-lookahead 120 -forced-idr 1
-strict_gop 1 -sc_threshold 0 -flags +cgop ^
-force_key_frames expr:gte(t,n_forced*2) -preset: llhp -pix_fmt nv12 -b:v
250M -minrate 250M -maxrate 250M -bufsize 250M ^
-c:a aac -ar 44100 -b:a 384k -ac 2 -af "aresample=async=250" -vsync 1 -ss
00:00:01.096 ^
-max_muxing_queue_size 9999 -f segment -segment_time 600 -segment_wrap 9
-reset_timestamps 1 ^
-segment_format_options max_delay=0 C:\Users\djcim\Videos\PS4\PS4\PS%02d.ts
^
-map 3:0,3:1 -map 3:1 -c:v h264_nvenc -r 60 -rc-lookahead 120 -forced-idr 1
-strict_gop 1 -sc_threshold 0 -flags +cgop ^
-force_key_frames expr:gte(t,n_forced*2) -preset: llhp -pix_fmt yuv420p
-b:v 40M -minrate 40M -maxrate 40M -bufsize 40M ^
-c:a aac -ar 44100 -b:a 384k -ac 2 -af "pan=mono|c0=c0, adelay=120|120,
aresample=async=250" -vsync 1 ^
-max_muxing_queue_size 9999 -f segment -segment_time 600 -segment_wrap 9
-reset_timestamps 1 ^
-segment_format_options max_delay=0
C:\Users\djcim\Videos\PS4\Camera\CPS%02d.ts

Writing to 4 files at once, 2 video (1080P60 + 4K60), and 2 "audio".
All four files are technically video, needed to generate blank video
and link to desired audio so parting would stay in sync with the 2
actual video files.

Many options and the file formats are put in place to ensure
synchronized and consistent parting across all four files. When I
want to record longer files I typically just increase the segment
time as opposed to entirely removing parting options. That being
said if your goal is to simply record one continuous 4K29.97 file
and nothing else with the equipment I have this would suffice:

-thread_queue_size 9999 -indexmem 9999 -f dshow -video_size 3840x2160
-rtbufsize 2147.48M -framerate 30000/1001 ^
-pixel_format nv12 -i video="Video (00 Pro Capture HDMI 4K+)" -map 0 -c:v
h264_nvenc -preset: llhp -pix_fmt nv12 ^
-b:v 250M -minrate 250M -maxrate 250M -bufsize 250M -max_muxing_queue_size
9999 Ouput.mp4

Encoding 4k60 with my 6800K immediately pegs all cores, even
the 7900X in my other PC can't handle it. NVENC seems to be
the only reasonable option, may be different for 4k30 though.


More information about the ffmpeg-user mailing list