[FFmpeg-user] FFmpeg: how to output over HTTP

wolfe.t.glenn wolfe.t.glenn at gmail.com
Mon Mar 18 20:27:43 EET 2019


To further make clear,

I understand and acknowledge that HTTP uses TCP, of course. My desired
behavior is simply to encapsulate the TCP packets with HTTP formatting and
send with POST/PUT headers to server.  The HTTP encapsulation is essential
for my use case.

I am able to make connection just fine, and send video data. It is just
using TCP for transport rather than encapsulating with TCP with HTTP.

Is there some 3rd party library I might be missing here?


On Mon, Mar 18, 2019 at 2:21 PM wolfe.t.glenn <wolfe.t.glenn at gmail.com>
wrote:

> Thanks Moritz,
>
> I tried to replicate your command, however, I am still only seeing TCP
> packets (rather than HTTP packets) in my Wireshark output.
>
> To be thorough, I have included my FFmpeg version commands for comparison.
>
> The full commands I am running can be seen below :
>
> From Client:
>
> `ffmpeg -re -i hq-video.mp4 -c:v libx264 -an -f mpegts
> http://0.0.0.0:5558/video` <http://0.0.0.0:5558/video>
>
> ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers
>   built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
>   configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.1 --enable-shared
> --enable-pthreads --enable-version3 --enable-hardcoded-tables
> --enable-avresample --cc=clang
> --host-cflags='-I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include
> -I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include/darwin'
> --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-libvorbis --enable-libvpx --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-videotoolbox --disable-libjack
> --disable-indev=jack --enable-libaom --enable-libsoxr
>   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
>   libavresample   4.  0.  0 /  4.  0.  0
>   libswscale      5.  3.100 /  5.  3.100
>   libswresample   3.  3.100 /  3.  3.100
>   libpostproc    55.  3.100 / 55.  3.100
>
>
> From Server:
>
> `ffmpeg -listen 1 -i http://0.0.0.0:5558/video -f null - `
>
> ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers
>   built with gcc 6.4.0 (Alpine 6.4.0)
>   configuration: --disable-debug --disable-doc --disable-ffplay
> --enable-ffmpeg --enable-protocol=rtp --enable-protocol=udp
> --enable-protocol=file --enable-protocol=crypto --enable-protocol=data
> --enable-encoder=mp4 --enable-encoder=rtp --enable-decoder=rtp
> --enable-encoder='rawvideo,libx264' --enable-decoder=h264
> --enable-encoder=h264 --enable-muxer=segment
> --enable-muxer='stream_segment,ssegment' --enable-muxer='rawvideo,mp4'
> --enable-muxer=rtsp --enable-muxer=h264 --enable-demuxer=rawvideo
> --enable-demuxer=mov --enable-demuxer=h264 --enable-demuxer=rtsp
> --enable-parser=h264 --enable-parser=mpeg4 --enable-avcodec
> --enable-avformat --enable-avfilter --enable-gpl --enable-small
> --enable-libx264 --enable-nonfree --enable-openssl
>   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
>
>
> Server is running inside alpine docker container. I have also tried
> running outside docker container on my local machine and still do not see
> any HTTP traffic.
>
>
> On Fri, Mar 15, 2019 at 7:27 AM Moritz Barsnick <barsnick at gmx.net> wrote:
>
>> On Thu, Mar 14, 2019 at 17:22:54 -0400, Glenn W wrote:
>> > So far, while testing on my local network I am using these commands,
>> which
>> > works, but uses TCP rather than HTTP. I need to use HTTP only.
>>
>> That's a bit of an ambiguous statement. TCP is layer 3, HTTP is layer
>> 7, and uses TCP underneath.
>>
>> > `ffmpeg -re -i hq-video.mp4 -c:v libx264 -an -bsf h264_mp4toannexb -f
>> > mpegts -chunked_post 1 http://0.0.0.0:5558/mpegts`
>> <http://0.0.0.0:5558/mpegts>
>>
>> Please always show us your complete, uncut console output together with
>> the command line.
>>
>> I didn't know you could connect to 0.0.0.0- :-)
>>
>> > Using Wireshark, I see that the output is being sent still over TCP,
>> rather
>> > than HTTP.
>>
>> I tried this:
>> $ ffmpeg -listen 1 -i http://localhost:8888/video -f null -
>> $ ffmpeg -f lavfi -i testsrc -t 1.55 -f mpegts http://0.0.0.0:8888/video
>>
>> and my Wireshark tell me it's using HTTP:
>> > POST /video HTTP/1.1
>> > Transfer-Encoding: chunked
>> > User-Agent: Lavf/58.26.101
>> > Accept: */*
>> > Connection: close
>> > Host: 0.0.0.0:8888
>> > Icy-MetaData: 1
>> >
>> < HTTP/1.1 200 OK
>> < Content-Type: application/octet-stream
>> < Transfer-Encoding: chunked
>> <
>> > [... bin data follows]
>>
>> Works perfectly for me.
>>
>> Moritz
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
>


More information about the ffmpeg-user mailing list