3

I tried doing this

ffmpeg -i tcp://192.168.1.41:5000?listen -c copy out.avi

and have another client publish to this server using

ffmpeg -i 1.avi -map 0 -c copy -f mjpeg tcp://192.168.1.41:5000

However, the ffprobe results I get for these two files are

Invalid return value 0 for stream protocol
    Last message repeated 1 times
Input #0, avi, from 'out2.avi':
  Metadata:
    encoder         : Lavf57.83.100
  Duration: 00:00:08.04, start: 0.000000, bitrate: 31181 kb/s
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 2048x1536, 31321 kb/s, 50 fps, 50 tbr, 50 tbn, 50 tbc

and

[mjpeg @ 0x177aea0] Changeing bps to 8
Input #0, avi, from '1.avi':
  Metadata:
    encoder         : Lavf54.20.4 
  Duration: 00:00:40.20, start: 0.000000, bitrate: 6235 kb/s
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 2048x1536, 6264 kb/s, 5 fps, 5 tbr, 5 tbn, 5 tbc

Although the file size is the same, I am not sure if they are still the same. Based on the output, it seems not. Can I know why?

What should be the command to send exact same stream to a remote server?

Update with the suggestion from @Mulvya

The output of using -f nut is as follows, which I don't quite understand why:

Invalid return value 0 for stream protocol
    Last message repeated 1 times
[nut @ 0x55cdee5959c0] No main startcode found.
tcp://192.168.1.41:5000?listen: Invalid data found when processing input
  • Are these interlaced images? – Gyan Apr 10 '18 at 11:14
  • I am not sure what interlaced images mean. The original video is produced using opencv by adding new frame one by one. – user10024395 Apr 10 '18 at 11:17
  • 1
    mjpeg is a raw stream, so ffmpeg has to assign a framerate if one isn't manually supplied. Default fps is 25 but yours shows as 50. Which may happen if at the receiving end, ffmpeg thinks there are two frames in a packet. Usually, those would be pair of interlaced pictures. – Gyan Apr 10 '18 at 12:25
  • @Mulvya is there a way to make the fps the same? e.g. a command that cos everything to be copied exactly. – user10024395 Apr 10 '18 at 15:19
  • Don't stream a raw stream i.e. use -f nut tcp://192.168.1.41:5000 in 2nd command. – Gyan Apr 10 '18 at 16:21

Your Answer

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

Browse other questions tagged or ask your own question.