I am looking stream video (likely with udp) between two instances of ffmpeg, without having any potential quality loss due to encoding. I am not too worried about bandwidth, I just want the stream to be real time and of the same quality as the input. The two main approaches that I have tried so far are encoding with huffyuv and using rawvideo. I have been able to encode with both options writing to a file that plays back fine, but I have not been able to create a stream that I can open with either. I have also seen that x264 has a lossless encoding option, however due to licensing constraints that isn't a great option for me.

Here are my successful command lines writing out to a file:

ffmpeg -i /dev/video0 -c:v huffyuv -f avi out.avi
ffmpeg -i /dev/video0 -c:v rawvideo -f nut out.nut

Here are my not so successful streaming attempts:

ffmpeg -i /dev/video0 -c:v huffyuv -f udp://
ffmpeg -i /dev/video0 -c:v rawvideo -f nut udp://

Then trying to stream I have tried having the receiving instance both auto detect and force streaming format:

ffplay udp://
ffplay -f avi -vcodec huffyuv udp://
ffplay -f nut -vcodec rawvideo udp://

For all of those combinations I get the same error:

udp:// Invalid data found when processing input

If you start your receiving instance before starting the serving instance, you can use

ffmpeg -i /dev/video0 -c:v huffyuv -f avi udp:// or nut, flv, matroska in place of avi. You won't be able to stop and restart the receiving instance.

If you need to accommodate a late start by the receiving instance or restarts, then you have to use a streaming format like mpegts. MPEG-TS does not support huffyuv or rawvideo. You're stuck with H.264/5 then.

Receiving instance is simply ffplay udp://

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.