[FFmpeg-devel] [PATCH] avformat: added named pipe protocol

Martin Sliwka martin.sliwka at gmail.com
Thu Jun 14 14:04:41 CEST 2012


Dne 14.6.2012 13:21, Michael Niedermayer napsal(a):
> On Thu, Jun 14, 2012 at 01:10:30PM +0200, Martin Sliwka wrote:
>> The new 'npipe' protocol is copy of 'file' protocol with two modifications:
>> 1) URLProtocol::url_seek is not set
>> 2) URLProtocol::url_open is set to npipe_open(...) which is same as
>> file_open(...)
>> except for protocol name it stripes from file name.
>>
>> New protocol is also very similar to already included 'pipe' protocol
>> which unfortunately can not be safely modified without breaking backward
>> compatibility.
>>
>> Reason for this change is that named pipes are not wokring as
>> seekable inputs.
>> Problem is that ffio_limit(...) incorrectly limits requested read
>> size because
>> avio_size(...) (it's fstat(...) in file_seek(...) in fact) can not
>> report correct
>> file size.
> do you have a testcase that shows the failure ?
>
>

As I'm using Windows it's a bit hard to debug this due to way how named 
pipes works here. I'm streaming raw image data to ffmpeg. When using 
stdin as input everything works as expected but using named pipes 
results in endless packet truncation/decoding errors.

Today I also found some related tickets:
http://ffmpeg.org/trac/ffmpeg/ticket/986
http://ffmpeg.org/trac/ffmpeg/ticket/1235

My command line and output follows:

ffmpeg.exe  -f rawvideo -s 1920x1080 -r 50 -pix_fmt bgr24 -i 
"\\.\pipe\1868_03B5D9C4_video.rgb" -f mp4 -map 0:0 -vcodec mpeg4 -y 
"D:\Video\output.mp4"

ffmpeg version N-41416-g718607b Copyright (c) 2000-2012 the FFmpeg 
developers
   built on Jun  8 2012 12:51:24 with gcc 4.6.3
   configuration: --disable-static --enable-shared --enable-gpl 
--enable-version3 --disable-w32threads --enable-runtime-cpudetect 
--enable-avisynth --enable-bzlib --enable-frei0r --enable-libass 
--enable-libcelt --enable-libopencore-amrnb --
enable-libopencore-amrwb --enable-libfreetype --enable-libgsm 
--enable-libmp3lame --enable-libnut --enable-libopenjpeg 
--enable-librtmp --enable-libschroedinger --enable-libspeex 
--enable-libtheora --enable-libutvideo --enable-libvo-aacenc
--enable-libvo-amrwbenc --enabl  libavutil      51. 56.100 / 51. 56.100
   libavcodec     54. 25.100 / 54. 25.100
   libavformat    54.  6.101 / 54.  6.101
   libavdevice    54.  0.100 / 54.  0.100
   libavfilter     2. 78.101 /  2. 78.101
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
Truncating packet of size 6220800 to 6188033
[rawvideo @ 00000000005436c0] Estimating duration from bitrate, this may 
be inaccurate
Input #0, rawvideo, from '\\.\pipe\1868_03B5D9C4_video.rgb':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: rawvideo (BGR[24] / 0x18524742), bgr24, 
1920x1080, 50 tbr, 50 tbn, 50 tbc
[buffer @ 000000000055f0a0] w:1920 h:1080 pixfmt:bgr24 tb:1/50 sar:0/1 
sws_param:flags=2
[ffmpeg_buffersink @ 000000000055f8e0] No opaque field provided
[format @ 000000000050dea0] auto-inserting filter 'auto-inserted scaler 
0' between the filter 'Parsed_null_0' and the filter 'format'
[buffer @ 000000000055f0a0] TB:0.020000
[auto-inserted scaler 0 @ 000000000055fea0] w:1920 h:1080 fmt:bgr24 
sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x4
Output #0, mp4, to 'D:\Video\output.mp4':
   Metadata:
     encoder         : Lavf54.6.101
     Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 
1920x1080, q=2-31, 200 kb/s, 50 tbn, 50 tbc
Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo -> mpeg4)
Press [q] to stop, [?] for help
Error while decoding stream #0:0: Error number -1 occurred
Truncating packet of size 6220800 to 1
Error while decoding stream #0:0: Error number -1 occurred
Truncating packet of size 6220800 to 1
Error while decoding stream #0:0: Error number -1 occurred
Truncating packet of size 6220800 to 1
Error while decoding stream #0:0: Error number -1 occurred
Truncating packet of size 6220800 to 1
Error while decoding stream #0:0: Error number -1 occurred
...


More information about the ffmpeg-devel mailing list