2

Im writing a program which getting the stream from ip camera, do with frame what i need and send to ffmpeg for transcoding. Then ffmpeg should convert video and send to output url. But when i running script, i get the error: "pipe:: Invalid data found when processing input". Im really newby in ffmpeg. Please help, what i doing wrong.


cap = cv2.VideoCapture("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov")

command = [
    "ffmpeg",
    "-i", "-",
    "-f", "mpegts",
    "-vcodec", "mpeg1video",
    "-s", "960x540",
    "-b:v", "1000K",
    "-r", "30",
    "-bf", "0",
    "-codec:a", "mp2",

    "http://127.0.0.1:8888/yoursecret"
]

proc = subprocess.Popen(command, stderr=subprocess.PIPE, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
out, err = proc.communicate()


print(err)

while True:
    ret, frame = cap.read()
    # _, buf = cv2.imencode('.jpg', frame)
    # img_byte = io.BytesIO(buf.tobytes())
    try: 
        proc.stdin.write(frame.tostring())
        print("SENDED")
    except IOError as e:
        print(e) 
        proc.stdin.close()
        proc.wait() 

proc.stdin.close()
proc.wait()

Traceback

ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.17)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
pipe:: Invalid data found when processing input
mamba9999
  • 31
  • 4
  • can u update the full error trace – AzyCrw4282 Apr 19 '20 at 11:08
  • I have a pretty similar issue https://stackoverflow.com/questions/75827168/ffmpeg-crashed-if-run-as-subprocess-from-nicegui?noredirect=1#comment133755878_75827168 Did you find a way to deal with it? – user1113159 Mar 24 '23 at 09:17

0 Answers0