Search code examples
curlchunked-encoding

how to specify the chunk size in a chunked post using curl


I am trying to send audio to a webservice that want the audio as a chunked post. Sending pre-recorded files works fine, but running the below code does not send anything to the server as it seems. Is curl trying to send everything in one chunk? I can't find any option to e.g. ask it to chunk every xxx bytes.

gst-launch-1.0 pulsesrc ! "audio/x-raw,rate=16000,channels=1,format=S16LE" ! fdsink sync=false | \
curl --header "Transfer-Encoding: chunked" --data-binary @- http://...

Solution

  • Actually there is a curlhttpsink in gst-plugins-bad and this works now: gst-launch-1.0 pulsesrc ! "audio/x-raw,rate=16000,channels=1,format=S16LE" ! curlhttpsink location=http://...

    This way you don't need to manually specify any chunk-size, since this is handled by the sink.