<p>I tried doing this </p>

<pre><code>ffmpeg -i tcp://192.168.1.41:5000?listen -c copy out.avi
</code></pre>

<p>and have another client publish to this server using</p>

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

<p>However, the ffprobe results I get for these two files are</p>

<pre><code>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
</code></pre>

<p>and</p>

<pre><code>[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
</code></pre>

<p>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?</p>

<p>What should be the command to send exact same stream to a remote server?</p>

<p><strong><em>Update with the suggestion from @Mulvya</em></strong></p>

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

<pre><code>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
</code></pre>

CC BY-SA 3.0
2018-04-10T11:14:54.433Z
Are these interlaced images?
Gyan
CC BY-SA 3.0
2018-04-10T11:17:49.793Z
I am not sure what interlaced images mean. The original video is produced using opencv by adding new frame one by one.
user10024395
CC BY-SA 3.0
2018-04-10T12:25:41.927Z
`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
CC BY-SA 3.0
2018-04-10T15:19:27.230Z
@Mulvya is there a way to make the fps the same? e.g. a command that cos everything to be copied exactly.
user10024395
CC BY-SA 3.0
2018-04-10T16:21:29.687Z
Don't stream a raw stream i.e. use `-f nut tcp://192.168.1.41:5000` in 2nd command.
Gyan
CC BY-SA 3.0
2018-04-12T10:41:40.017Z
only -c copy will at least give same size of files but different ffprobe output @Mulvya
user10024395
CC BY-SA 3.0
2018-04-12T15:26:28.647Z
Why do you want to obtain exactly the original file by streaming?
aleb
CC BY-SA 3.0
2018-04-12T16:39:39.637Z
@aleb Actually I just need exactly same quality. However, I am not sure how I should gauge the same quality other than file size? Previously, I thought -crf 0 means best quality but how it is bigger than the original file by many factors which doesnt make sense. Why is it much bigger and yet the quality is not better? (Not better because you can't have a converted file that is higher quality than the original file)
user10024395
CC BY-SA 3.0
2018-04-12T16:40:11.573Z
@aleb Are you implying streaming has to lose some quality?
user10024395
CC BY-SA 3.0
2018-04-12T18:47:33.050Z
Just to make sure it's not the container, try with `-f avi`
Gyan
CC BY-SA 3.0
2018-04-12T20:56:59.183Z
Check whether it's the same quality by doing something like `ffmpeg -i IN -c:v copy OUT.mkv` for *both* the source and the copy, and compare that.
aleb
<video><ffmpeg>
How to use ffmpeg to send video stream to another server that gives exactly same quality as manually copying the file to that server?
user10024395
# How to use ffmpeg to send video stream to another server that gives exactly same quality as manually copying the file to that server?

(Asked by: username_0 on 2018-04-10)

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

**Tags:** video, ffmpeg

> **Comments:**
> **username_1**: Are these interlaced images?  
> **username_0**: I am not sure what interlaced images mean. The original video is produced using opencv by adding new frame one by one.  
> **username_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.  
> **username_0**: @Mulvya is there a way to make the fps the same? e.g. a command that cos everything to be copied exactly.  
> **username_1**: Don't stream a raw stream i.e. use `-f nut tcp://192.168.1.41:5000` in 2nd command.  
> **username_0**: only -c copy will at least give same size of files but different ffprobe output @Mulvya  
> **username_2**: Why do you want to obtain exactly the original file by streaming?  
> **username_0**: @username_2 Actually I just need exactly same quality. However, I am not sure how I should gauge the same quality other than file size? Previously, I thought -crf 0 means best quality but how it is bigger than the original file by many factors which doesnt make sense. Why is it much bigger and yet the quality is not better? (Not better because you can't have a converted file that is higher quality than the original file)  
> **username_0**: @username_2 Are you implying streaming has to lose some quality?  
> **username_1**: Just to make sure it's not the container, try with `-f avi`  
> **username_2**: Check whether it's the same quality by doing something like `ffmpeg -i IN -c:v copy OUT.mkv` for *both* the source and the copy, and compare that.  

---

## 0 answers

