VB.NET Streaming Image Using Imag2Pipe Issue

Questions involving a Windows version of FFmpeg.
Post Reply
zakirSZH
Posts: 7
Joined: Fri Mar 08, 2013 4:52 am

VB.NET Streaming Image Using Imag2Pipe Issue

Post by zakirSZH » Sun Oct 20, 2019 1:45 am

i am trying so hard to stream images from my .net application to ffmepg using image2pipe.

after a lot of trail and error.. i came to very close.. but now facing following issue:

[bmp @ 02690240] not enough data (194700 < 2764854), trying to decode anyway

here is the sample code that i used:

Code: Select all

        Dim objFProcess As System.Diagnostics.Process
        Dim o2 As System.Drawing.Bitmap
        Dim o1 As System.IO.BinaryWriter
        Dim strCLIText As String
        Dim strFiles() As String
        Dim strEachFile As String
        objFProcess = New System.Diagnostics.Process
        objFProcess.StartInfo.FileName = txtFMPEG.Text
        objFProcess.StartInfo.Arguments = "-y -f image2pipe -r 25 -s 1280x720 -vcodec bmp -i pipe:.bmp -crf 25.0 -vcodec libx264 -vf scale=1280:720 -coder 1 -rc_lookahead 60 -threads 0 g:\test.mp4"
        objFProcess.StartInfo.UseShellExecute = False
        objFProcess.StartInfo.CreateNoWindow = True
        objFProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
        objFProcess.StartInfo.RedirectStandardError = True
        objFProcess.StartInfo.RedirectStandardInput = True
        objFProcess.Start()
        o1 = New System.IO.BinaryWriter(objFProcess.StandardInput.BaseStream)
        strFiles = System.IO.Directory.GetFiles(txtIMGDir.Text, "*.bmp", IO.SearchOption.TopDirectoryOnly)
        For Each strEachFile In strFiles
            Me.Text = System.IO.Path.GetFileNameWithoutExtension(strEachFile)
            My.Application.DoEvents()
            Using imgStream As System.IO.FileStream = New System.IO.FileStream(strEachFile, IO.FileMode.Open, IO.FileAccess.Read)
                o2 = CType(System.Drawing.Bitmap.FromStream(imgStream), System.Drawing.Bitmap)
                o2.Save(o1.BaseStream, System.Drawing.Imaging.ImageFormat.Bmp)
                o2.Dispose()
                o2 = Nothing
                'o1.Flush()
            End Using
        Next
        o1.Flush()
        o1.Close()
        objFProcess.WaitForExit()
        strCLIText = objFProcess.StandardError.ReadToEnd
        objFProcess.Close()
        objFProcess.Dispose()
        objFProcess = Nothing
        saveText2File(strAPPPath & "\wtf-13.txt", strCLIText)
and this is the response i am getting: (from file wtf-13.txt)

Code: Select all

ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --disable-static --enable-shared --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. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[bmp @ 0268fcc0] not enough data (194700 < 2764854), trying to decode anyway
[bmp @ 0268fcc0] not enough data (194646 < 2764800)
Input #0, image2pipe, from 'pipe:.bmp':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: bmp, bgr24, 1280x720, 25 tbr, 25 tbn, 25 tbc
Codec AVOption rc_lookahead (Number of frames to look ahead for alternate reference frame selection) specified for output file #0 (g:\test.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))
[bmp @ 02690240] not enough data (194700 < 2764854), trying to decode anyway
[bmp @ 02690240] not enough data (194646 < 2764800)
Error while decoding stream #0:0: Invalid data found when processing input
[libx264 @ 0267fc80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0267fc80] profile High 4:4:4 Predictive, level 3.1, 4:4:4, 8-bit
[libx264 @ 0267fc80] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=25.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'g:\test.mp4':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1280x720, q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.35.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
any help please?

thanks in advance..

best regards

zakirSZH
Posts: 7
Joined: Fri Mar 08, 2013 4:52 am

Re: VB.NET Streaming Image Using Imag2Pipe Issue

Post by zakirSZH » Mon Oct 21, 2019 1:08 am

any help? any one?

pandy
Posts: 255
Joined: Mon Feb 24, 2014 1:46 pm

Re: VB.NET Streaming Image Using Imag2Pipe Issue

Post by pandy » Tue Oct 22, 2019 4:38 pm

Sorry for not helping but perhaps you should consider NUT instead image2pipe...
https://ffmpeg.org/nut.html

Post Reply
'