I am creating a c# application to record videos H264. The workflow of my application is like this: 1) My application connects to a webcam using DirectShow and presents the frames in the UI; 2) When recording the app starts a FFmpeg process that accepts a video input from a pipe; 3) After that in my app a NamedPipeServerStream is created and the frames are wrote there. Till now, I never had a problem with this method, but yesterday I started having problems in a new computer. The problem seems to be related with the creation of the pipe. This is the command I am currently running: -loglevel debug -thread_queue_size 1024 -framerate 30 -f rawvideo -pix_fmt bgra -video_size 848x480 -use_wallclock_as_timestamps true -i \\.\pipe\28e1b96a-c6ea-43f2-88a0-2e7e4bfb48ed -framerate 25 -vcodec libx264 -crf 23 -pix_fmt yuv420p -preset ultrafast -framerate 30 "2032787211637070049780945982.mp4" And these are the logs I got from running the command: ffmpeg version N-91715-gd71dfc087b Copyright (c) 2000-2018 the FFmpeg developers built with gcc 8.2.1 (GCC) 20180813 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth libavutil 56. 19.100 / 56. 19.100 libavcodec 58. 27.100 / 58. 27.100 libavformat 58. 17.103 / 58. 17.103 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 26.100 / 7. 26.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 Splitting the commandline. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. Reading option '-thread_queue_size' ... matched as option 'thread_queue_size' (set the maximum number of queued packets from the demuxer) with argument '1024'. Reading option '-framerate' ... matched as AVOption 'framerate' with argument '30'. Reading option '-f' ... matched as option 'f' (force format) with argument 'rawvideo'. Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'bgra'. Reading option '-video_size' ... matched as AVOption 'video_size' with argument '848x480'. Reading option '-use_wallclock_as_timestamps' ... matched as AVOption 'use_wallclock_as_timestamps' with argument 'true'. Reading option '-i' ... matched as input url with argument '\\.\pipe\28e1b96a-c6ea-43f2-88a0-2e7e4bfb48ed'. Reading option '-framerate' ... matched as AVOption 'framerate' with argument '25'. Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'libx264'. Reading option '-crf' ... matched as AVOption 'crf' with argument '23'. Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'. Reading option '-preset' ... matched as AVOption 'preset' with argument 'ultrafast'. Reading option '-framerate' ... matched as AVOption 'framerate' with argument '30'. Reading option '2032787211637070049780945982.mp4' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option loglevel (set logging level) with argument debug. Successfully parsed a group of options. Parsing a group of options: input url \\.\pipe\28e1b96a-c6ea-43f2-88a0-2e7e4bfb48ed. Applying option thread_queue_size (set the maximum number of queued packets from the demuxer) with argument 1024. Applying option f (force format) with argument rawvideo. Applying option pix_fmt (set pixel format) with argument bgra. Successfully parsed a group of options. Opening an input file: \\.\pipe\28e1b96a-c6ea-43f2-88a0-2e7e4bfb48ed. [rawvideo @ 0000017f0409aec0] Opening '\\.\pipe\28e1b96a-c6ea-43f2-88a0-2e7e4bfb48ed' for reading [file @ 0000017f0409c800] Setting default whitelist 'file,crypto' \\.\pipe\28e1b96a-c6ea-43f2-88a0-2e7e4bfb48ed: Invalid argument The really strange part of this, is that sometimes it works... Here are the logs of when it works: ffmpeg version N-91715-gd71dfc087b Copyright (c) 2000-2018 the FFmpeg developers built with gcc 8.2.1 (GCC) 20180813 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth libavutil 56. 19.100 / 56. 19.100 libavcodec 58. 27.100 / 58. 27.100 libavformat 58. 17.103 / 58. 17.103 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 26.100 / 7. 26.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 Splitting the commandline. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. Reading option '-thread_queue_size' ... matched as option 'thread_queue_size' (set the maximum number of queued packets from the demuxer) with argument '1024'. Reading option '-framerate' ... matched as AVOption 'framerate' with argument '30'. Reading option '-f' ... matched as option 'f' (force format) with argument 'rawvideo'. Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'bgra'. Reading option '-video_size' ... matched as AVOption 'video_size' with argument '800x600'. Reading option '-use_wallclock_as_timestamps' ... matched as AVOption 'use_wallclock_as_timestamps' with argument 'true'. Reading option '-i' ... matched as input url with argument '\\.\pipe\323d0c98-87bf-4153-abfb-cedbf20ad0e4'. Reading option '-framerate' ... matched as AVOption 'framerate' with argument '25'. Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'libx264'. Reading option '-crf' ... matched as AVOption 'crf' with argument '23'. Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'. Reading option '-preset' ... matched as AVOption 'preset' with argument 'ultrafast'. Reading option '-framerate' ... matched as AVOption 'framerate' with argument '30'. Reading option '2032787211637070057686657001.mp4' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option loglevel (set logging level) with argument debug. Successfully parsed a group of options. Parsing a group of options: input url \\.\pipe\323d0c98-87bf-4153-abfb-cedbf20ad0e4. Applying option thread_queue_size (set the maximum number of queued packets from the demuxer) with argument 1024. Applying option f (force format) with argument rawvideo. Applying option pix_fmt (set pixel format) with argument bgra. Successfully parsed a group of options. Opening an input file: \\.\pipe\323d0c98-87bf-4153-abfb-cedbf20ad0e4. [rawvideo @ 000002247083aec0] Opening '\\.\pipe\323d0c98-87bf-4153-abfb-cedbf20ad0e4' for reading [file @ 000002247083c7c0] Setting default whitelist 'file,crypto' [rawvideo @ 000002247083aec0] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1 [rawvideo @ 000002247083aec0] All info found [rawvideo @ 000002247083aec0] After avformat_find_stream_info() pos: 1920000 bytes read:1920000 seeks:0 frames:1 Input #0, rawvideo, from '\\.\pipe\323d0c98-87bf-4153-abfb-cedbf20ad0e4': Duration: N/A, start: 1571405369.800000, bitrate: 460800 kb/s Stream #0:0, 1, 1/30: Video: rawvideo, 1 reference frame (BGRA / 0x41524742), bgra, 800x600, 0/1, 460800 kb/s, 30 tbr, 30 tbn, 30 tbc Successfully opened the file. Parsing a group of options: output url 2032787211637070057686657001.mp4. Applying option vcodec (force video codec ('copy' to copy stream)) with argument libx264. Applying option pix_fmt (set pixel format) with argument yuv420p. Successfully parsed a group of options. Opening an output file: 2032787211637070057686657001.mp4. [file @ 00000224708400c0] Setting default whitelist 'file,crypto' Successfully opened the file. Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264)) Press [q] to stop, [?] for help cur_dts is invalid (this is harmless if it occurs once at the start per stream) [rawvideo @ 000002247084ea80] PACKET SIZE: 1920000, STRIDE: 3200 detected 8 logical cores [graph 0 input from stream 0:0 @ 0000022470840580] Setting 'video_size' to value '800x600' [graph 0 input from stream 0:0 @ 0000022470840580] Setting 'pix_fmt' to value '28' [graph 0 input from stream 0:0 @ 0000022470840580] Setting 'time_base' to value '1/30' [graph 0 input from stream 0:0 @ 0000022470840580] Setting 'pixel_aspect' to value '0/1' [graph 0 input from stream 0:0 @ 0000022470840580] Setting 'sws_param' to value 'flags=2' [graph 0 input from stream 0:0 @ 0000022470840580] Setting 'frame_rate' to value '30/1' [graph 0 input from stream 0:0 @ 0000022470840580] w:800 h:600 pixfmt:bgra tb:1/30 fr:30/1 sar:0/1 sws_param:flags=2 [format @ 0000022470843380] Setting 'pix_fmts' to value 'yuv420p' [auto_scaler_0 @ 0000022470843800] Setting 'flags' to value 'bicubic' [auto_scaler_0 @ 0000022470843800] w:iw h:ih flags:'bicubic' interl:0 [format @ 0000022470843380] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format' [AVFilterGraph @ 000002247083a500] query_formats: 4 queried, 2 merged, 1 already done, 0 delayed [auto_scaler_0 @ 0000022470843800] w:800 h:600 fmt:bgra sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x4 [libx264 @ 000002247083f080] using mv_range_thread = 24 [libx264 @ 000002247083f080] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 000002247083f080] profile Constrained Baseline, level 3.1, 4:2:0, 8-bit [libx264 @ 000002247083f080] 264 - core 157 r2932 303c484 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0 Output #0, mp4, to '2032787211637070057686657001.mp4': Metadata: encoder : Lavf58.17.103 Stream #0:0, 0, 1/15360: Video: h264 (libx264), 1 reference frame (avc1 / 0x31637661), yuv420p, 800x600, 0/1, q=-1--1, 30 fps, 15360 tbn, 30 tbc Metadata: encoder : Lavc58.27.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Clipping frame in rate conversion by 0.000008 cur_dts is invalid (this is harmless if it occurs once at the start per stream) [rawvideo @ 000002247084ea80] PACKET SIZE: 1920000, STRIDE: 3200 cur_dts is invalid (this is harmless if it occurs once at the start per stream) [rawvideo @ 000002247084ea80] PACKET SIZE: 1920000, STRIDE: 3200 cur_dts is invalid (this is harmless if it occurs once at the start per stream) [rawvideo @ 000002247084ea80] PACKET SIZE: 1920000, STRIDE: 3200 cur_dts is invalid (this is harmless if it occurs once at the start per stream) [rawvideo @ 000002247084ea80] PACKET SIZE: 1920000, STRIDE: 3200 cur_dts is invalid (this is harmless if it occurs once at the start per stream) [rawvideo @ 000002247084ea80] PACKET SIZE: 1920000, STRIDE: 3200 cur_dts is invalid (this is harmless if it occurs once at the start per stream) [rawvideo @ 000002247084ea80] PACKET SIZE: 1920000, STRIDE: 3200 [...] Anyone ever had this problem and knows how to fix it? or at least where can I look for more information about it. Thanks in advance, Alessandro.