Answers.Body: <p>This can't normally be done, but luckily for you, MJPEG is a codec for which streamcopy + piping can work</p>
  
  <pre><code>ffmpeg -i in.avi -c copy -f image2pipe - | ffmpeg -f image2pipe -framerate 50 -i - -c copy out.mp4
  </code></pre>
  
  <hr>
  
  <p>The JPEG frames in your input are malformed. For such streams, it's a two step process</p>
  
  <pre><code>ffmpeg -i in.avi -c copy frames%d.jpg
  
  ffmpeg -framerate 50 -i frames%d.jpg -c copy out.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-30T20:34:33.230Z
Answers.Text: Thanks, I've tried this approach, but although the input and output file are almost the same size, there are (pretty big) jumps in the output video. (Even when stepping frame by frame in VLC).
Answers.UserDisplayName: Balint
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-31T05:22:13.810Z
Answers.Text: Share the full log. Is the input variable framerate? By jumps in output - do you mean missing frames?
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-31T11:08:59.230Z
Answers.Text: Here is [the log](https://pastebin.com/ZFdCdw4q). I think the input is constant 1 FPS. By jumps I mean missing frames, as you can see at the bottom of the log: only 286 remained from the 1000 input frames.
Answers.UserDisplayName: Balint
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-31T14:59:30.980Z
Answers.Text: Can you share this sample? I suspect packet parsing issues. You can also dump frames to an image sequence instead of pipe and then use them in step 2.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-31T20:42:01.627Z
Answers.Text: Sure, [here](https://a.rokket.space/836imz.avi) it is.
Answers.UserDisplayName: Balint
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-01T07:17:35.780Z
Answers.Text: See edited command. Consider filing a [bug report](https://ffmpeg.org/bugreports.html)
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-30T14:35:28.750Z
Answers.LastActivityDate: 2018-04-01T07:16:01.670Z
Answers.LastEditDate: 2018-04-01T07:16:01.670Z
Answers.UserDisplayName: Gyan
Body: <p>I have lots of large <code>mjpeg</code> timelapse videos, and I would like to speed them up with ffmpeg without loosing quality, dropping or creating frames.</p>
  
  <pre><code>Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720, 605 kb/s, 1 fps, 1 tbr, 1 tbn, 1 tbc
  </code></pre>
  
  <p>The only way I got it working is <code>ffmpeg -r 10 -i video.avi -vsync 0 output.mp4</code>, but this encodes the output with mpeg4. If I use <code>-vcodec copy</code>, the <code>-r 10</code> looses its power. The <code>PTS</code> rescaling method creates and drops frames. I do not care about timestamps, I want a file with all of the input frames at a fixed (higher) frame rate. 
  Is there a simpler solution than <a href="https://superuser.com/questions/1088382/change-framerate-in-ffmpeg-without-reencoding">this</a>? Maybe with <code>image2pipe</code>?</p>
  
Tags: <ffmpeg>
Title: How to change framerate with ffmpeg without re-encoding?
UserDisplayName: Balint
ThreadText: # How to change framerate with ffmpeg without re-encoding?
  
  (Asked by: username_0 on 2018-03-30)
  
  I have lots of large `mjpeg` timelapse videos, and I would like to speed them up with ffmpeg without loosing quality, dropping or creating frames.
  
  ```
  Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720, 605 kb/s, 1 fps, 1 tbr, 1 tbn, 1 tbc
  
  ```
  
  The only way I got it working is `ffmpeg -r 10 -i video.avi -vsync 0 output.mp4`, but this encodes the output with mpeg4. If I use `-vcodec copy`, the `-r 10` looses its power. The `PTS` rescaling method creates and drops frames. I do not care about timestamps, I want a file with all of the input frames at a fixed (higher) frame rate.
  Is there a simpler solution than [this](https://superuser.com/questions/1088382/change-framerate-in-ffmpeg-without-reencoding)? Maybe with `image2pipe`?
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-03-30. Score: 3 | Accepted answer
  
  This can't normally be done, but luckily for you, MJPEG is a codec for which streamcopy + piping can work
  
  ```
  ffmpeg -i in.avi -c copy -f image2pipe - | ffmpeg -f image2pipe -framerate 50 -i - -c copy out.mp4
  
  ```
  
  ---
  
  The JPEG frames in your input are malformed. For such streams, it's a two step process
  
  ```
  ffmpeg -i in.avi -c copy frames%d.jpg
  
  ffmpeg -framerate 50 -i frames%d.jpg -c copy out.mp4
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks, I've tried this approach, but although the input and output file are almost the same size, there are (pretty big) jumps in the output video. (Even when stepping frame by frame in VLC).  
  > **username_1**: Share the full log. Is the input variable framerate? By jumps in output - do you mean missing frames?  
  > **username_0**: Here is [the log](https://pastebin.com/ZFdCdw4q). I think the input is constant 1 FPS. By jumps I mean missing frames, as you can see at the bottom of the log: only 286 remained from the 1000 input frames.  
  > **username_1**: Can you share this sample? I suspect packet parsing issues. You can also dump frames to an image sequence instead of pipe and then use them in step 2.  
  > **username_0**: Sure, [here](https://a.rokket.space/836imz.avi) it is.  
  > **username_1**: See edited command. Consider filing a [bug report](https://ffmpeg.org/bugreports.html)  
  
  ---
  
  