Answers.Body: <p>The 'copy' codec tells avconv to skip decoding and encoding. It is useful if you are trying to change the container format but in your case, you are changing the format of the stream from MJPEG to H264.</p>
  
  <p>Just leave '-vcodec copy' out and let avconv figure out that it must transcode from mjpeg to H264:</p>
  
  <pre><code>avconv -i rtsp://admin:admin@192.168.11.11/streaming/Channels/2 -map 0  -f H264 udp://192.168.10.11:5014
  
  [mjpeg @ 0x113f1d0] Changeing bps to 8
  Input #0, rtsp, from 'rtsp://admin:admin@192.168.11.11/streaming/Channels/2':
    Metadata:
      title           : Media Presentation
    Duration: N/A, start: 0.000000, bitrate: N/A
      Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 320x240 [SAR 1:1 DAR 4:3], 50 tbr, 90k tbn, 90k tb
  No pixel format specified, yuvj420p for H.264 encoding chosen.
  Use -pix_fmt yuv420p for compatibility with outdated media players.
  [libx264 @ 0x116a980] using SAR=1/1
  [libx264 @ 0x116a980] using cpu capabilities: ARMv6 NEON
  [libx264 @ 0x116a980] profile High, level 2.1
  Output #0, h264, to 'udp://192.168.10.11:5014':
    Metadata:
      title           : Media Presentation
      encoder         : Lavf56.40.101
      Stream #0:0: Video: h264 (libx264), yuvj420p(pc), 320x240 [SAR 1:1 DAR 4:3], q=-1--1, 50 fps, 50 tbn, 50 tbc
      Metadata:
        encoder         : Lavc56.60.100 libx264
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (mjpeg (native) -&gt; h264 (libx264))
  
  Press [q] to stop, [?] for help
  frame=   51 fps= 34 q=31.0 Lsize=       9kB time=00:00:00.98 bitrate=  71.7kbits/s dup=40 drop=0    
  video:9kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB  muxing overhead: 0.000000%
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-17T15:58:33.400Z
Answers.LastActivityDate: 2016-11-17T15:58:33.400Z
Answers.UserDisplayName: Solar.gy
Body: <p>I have an MJPEG test source (local business has publicly available source) that I’m trying to transcode to an RTSP stream for consumption by Evostream.</p>
  
  <p>I have tried with and without the -vcodec copy parameter, but I cannot seem to get it to stream properly.</p>
  
  <p>Here is my streaming command:</p>
  
  <pre><code>#avconv -f mjpeg -i http://sics.com:9001/mjpeg.cgi -vcodec copy -f rtsp -muxdelay 0.1 -metadata streamName=mjpStream rtsp://127.0.0.1:5544/
  </code></pre>
  
  <p>And the resulting output:</p>
  
  <pre><code>avconv version 0.8.17-4:0.8.17-0ubuntu0.12.04.1, Copyright (c) 2000-2014 the Libav developers
    built on Mar 16 2015 13:26:50 with gcc 4.6.3
  [mjpeg @ 0x20ae9e0] max_analyze_duration reached
  [mjpeg @ 0x20ae9e0] Estimating duration from bitrate, this may be inaccurate
  Input #0, mjpeg, from 'http://sics.com:9001/mjpeg.cgi':
    Duration: N/A, bitrate: N/A
      Stream #0.0: Video: mjpeg, yuvj422p, 320x240, 25 fps, 25 tbr, 1200k tbn, 1200k tbc
  Output #0, rtsp, to 'rtsp://127.0.0.1:5544/':
    Metadata:
      streamName      : mjpStream
      encoder         : Lavf53.21.1
      Stream #0.0: Video: mjpeg, yuvj422p, 320x240, q=2-31, 90k tbn, 1200k tbc
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (copy)
  Could not write header for output file #0 (incorrect codec parameters ?)
  </code></pre>
  
Tags: <streaming><avconv>
Title: AVCONV to transcode MJPEG to RTSP
UserDisplayName: Joshua Jackson
ThreadText: # AVCONV to transcode MJPEG to RTSP
  
  (Asked by: username_0 on 2015-04-28)
  
  I have an MJPEG test source (local business has publicly available source) that I’m trying to transcode to an RTSP stream for consumption by Evostream.
  
  I have tried with and without the -vcodec copy parameter, but I cannot seem to get it to stream properly.
  
  Here is my streaming command:
  
  ```
  #avconv -f mjpeg -i http://sics.com:9001/mjpeg.cgi -vcodec copy -f rtsp -muxdelay 0.1 -metadata streamName=mjpStream rtsp://127.0.0.1:5544/
  
  ```
  
  And the resulting output:
  
  ```
  avconv version 0.8.17-4:0.8.17-0ubuntu0.12.04.1, Copyright (c) 2000-2014 the Libav developers
    built on Mar 16 2015 13:26:50 with gcc 4.6.3
  [mjpeg @ 0x20ae9e0] max_analyze_duration reached
  [mjpeg @ 0x20ae9e0] Estimating duration from bitrate, this may be inaccurate
  Input #0, mjpeg, from 'http://sics.com:9001/mjpeg.cgi':
    Duration: N/A, bitrate: N/A
      Stream #0.0: Video: mjpeg, yuvj422p, 320x240, 25 fps, 25 tbr, 1200k tbn, 1200k tbc
  Output #0, rtsp, to 'rtsp://127.0.0.1:5544/':
    Metadata:
      streamName      : mjpStream
      encoder         : Lavf53.21.1
      Stream #0.0: Video: mjpeg, yuvj422p, 320x240, q=2-31, 90k tbn, 1200k tbc
  Stream mapping:
    Stream #0:0 -> #0:0 (copy)
  Could not write header for output file #0 (incorrect codec parameters ?)
  
  ```
  
  **Tags:** streaming, avconv
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-11-17. Score: 2
  
  The 'copy' codec tells avconv to skip decoding and encoding. It is useful if you are trying to change the container format but in your case, you are changing the format of the stream from MJPEG to H264.
  
  Just leave '-vcodec copy' out and let avconv figure out that it must transcode from mjpeg to H264:
  
  ```
  avconv -i rtsp://admin:admin@192.168.11.11/streaming/Channels/2 -map 0  -f H264 udp://192.168.10.11:5014
  
  [mjpeg @ 0x113f1d0] Changeing bps to 8
  Input #0, rtsp, from 'rtsp://admin:admin@192.168.11.11/streaming/Channels/2':
    Metadata:
      title           : Media Presentation
    Duration: N/A, start: 0.000000, bitrate: N/A
      Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 320x240 [SAR 1:1 DAR 4:3], 50 tbr, 90k tbn, 90k tb
  No pixel format specified, yuvj420p for H.264 encoding chosen.
  Use -pix_fmt yuv420p for compatibility with outdated media players.
  [libx264 @ 0x116a980] using SAR=1/1
  [libx264 @ 0x116a980] using cpu capabilities: ARMv6 NEON
  [libx264 @ 0x116a980] profile High, level 2.1
  Output #0, h264, to 'udp://192.168.10.11:5014':
    Metadata:
      title           : Media Presentation
      encoder         : Lavf56.40.101
      Stream #0:0: Video: h264 (libx264), yuvj420p(pc), 320x240 [SAR 1:1 DAR 4:3], q=-1--1, 50 fps, 50 tbn, 50 tbc
      Metadata:
        encoder         : Lavc56.60.100 libx264
  Stream mapping:
    Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
  
  Press [q] to stop, [?] for help
  frame=   51 fps= 34 q=31.0 Lsize=       9kB time=00:00:00.98 bitrate=  71.7kbits/s dup=40 drop=0    
  video:9kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB  muxing overhead: 0.000000%
  
  ```
  
  
  ---
  
  