Answers.Body: <p>The tee muxer is suitable for this.</p>
  
  <pre><code>ffmpeg \
  -f v4l2 -standard PAL -thread_queue_size 2048 -i /dev/video1 \
  -f alsa -thread_queue_size 2048 -i hw:2,0 \
  -map 0 -map 1 \
  -vf yadif=1 \
  -vcodec libx264 -preset superfast -crf 23 -flags +global_header \
  -acodec libmp3lame -b:a 128k -ac 2 -ar 48000 \
  -f tee "vhs_output.mov|[f=nut:onfail=ignore]pipe:1" | ffplay -
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-11T16:17:25.590Z
Answers.Text: Yes, now it can encode without dropping frames using the tee object. On the other hander, the FFplay window never appeared. I've got this message "pipe:: Invalid data found when processing input" after safely exiting FFmpeg. I also notice that there are two files created. ("vhs_output.mov" and " -")
Answers.UserDisplayName: Thomas Devoogdt
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-11T16:54:33.000Z
Answers.Text: See edited command
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-11T18:04:51.607Z
Answers.Text: Thank you, that did the trick! I hope that it can help others for similar purposes.
Answers.UserDisplayName: Thomas Devoogdt
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-11T12:46:12.897Z
Answers.LastActivityDate: 2018-05-11T16:54:21.090Z
Answers.LastEditDate: 2018-05-11T16:54:21.090Z
Answers.UserDisplayName: Gyan
Body: <h2>Digitize a VHS tape with FFmpeg</h2>
  
  <p>On <a href="https://gordonlesti.com/digitize-a-vhs-tape-with-ffmpeg-and-easycap-on-linux/" rel="noreferrer">this</a> thread, I found a perfect command to digitize a VHS tape with FFmpeg using a USB video grabber. All good with that; it works like a charm. Acceptable bitrate, no dropped frames and, most importantly, a good output file. </p>
  
  <p><strong>Working command:</strong></p>
  
  <pre><code>ffmpeg \
  -f v4l2 -standard PAL -thread_queue_size 2048 -i /dev/video1 \
  -f alsa -thread_queue_size 2048 -i hw:2,0 \ 
  -vcodec libx264 -preset superfast -crf 23 -vf yadif=1 \
  -acodec libmp3lame -b:a 128k -channels 2 -ar 48000 \
  vhs_output.mov
  </code></pre>
  
  <h2>Question: How to get a live preview?</h2>
  
  <p>I've read numerous threads talking about pipes and tee objects, but I still haven't figured out how to get a live preview. </p>
  
  <p><strong>My try for a ffplay pipe:</strong></p>
  
  <pre><code>ffmpeg \
  -f v4l2 -standard PAL -thread_queue_size 2048 -i /dev/video1 \
  -f alsa -thread_queue_size 2048 -i hw:2,0 \ 
  -vcodec libx264 -preset superfast -crf 23 -vf yadif=1 \
  -acodec libmp3lame -b:a 128k -channels 2 -ar 48000 \
  vhs_output.mov \
  -f h264 - | ffplay -
  </code></pre>
  
  <p>The problem with this command is that there are now two x264 encoders active. Secondly, the preview isn't as fluid as the output since there are now lot's of dropped frames. Where have I gone wrong? How can I reuse the first output? Raw piping isn't an option since ffplay can't handle it. </p>
  
Tags: <ffmpeg><encoding><vhs><preview>
Title: Digitize a VHS tape with FFmpeg and get a live preview
UserDisplayName: Thomas Devoogdt
ThreadText: # Digitize a VHS tape with FFmpeg and get a live preview
  
  (Asked by: username_0 on 2018-05-11)
  
  ## Digitize a VHS tape with FFmpeg
  
  On [this](https://gordonlesti.com/digitize-a-vhs-tape-with-ffmpeg-and-easycap-on-linux/) thread, I found a perfect command to digitize a VHS tape with FFmpeg using a USB video grabber. All good with that; it works like a charm. Acceptable bitrate, no dropped frames and, most importantly, a good output file.
  
  **Working command:**
  
  ```
  ffmpeg \
  -f v4l2 -standard PAL -thread_queue_size 2048 -i /dev/video1 \
  -f alsa -thread_queue_size 2048 -i hw:2,0 \ 
  -vcodec libx264 -preset superfast -crf 23 -vf yadif=1 \
  -acodec libmp3lame -b:a 128k -channels 2 -ar 48000 \
  vhs_output.mov
  
  ```
  
  ## Question: How to get a live preview?
  
  I've read numerous threads talking about pipes and tee objects, but I still haven't figured out how to get a live preview.
  
  **My try for a ffplay pipe:**
  
  ```
  ffmpeg \
  -f v4l2 -standard PAL -thread_queue_size 2048 -i /dev/video1 \
  -f alsa -thread_queue_size 2048 -i hw:2,0 \ 
  -vcodec libx264 -preset superfast -crf 23 -vf yadif=1 \
  -acodec libmp3lame -b:a 128k -channels 2 -ar 48000 \
  vhs_output.mov \
  -f h264 - | ffplay -
  
  ```
  
  The problem with this command is that there are now two x264 encoders active. Secondly, the preview isn't as fluid as the output since there are now lot's of dropped frames. Where have I gone wrong? How can I reuse the first output? Raw piping isn't an option since ffplay can't handle it.
  
  **Tags:** ffmpeg, encoding, vhs, preview
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-05-11. Score: 8 | Accepted answer
  
  The tee muxer is suitable for this.
  
  ```
  ffmpeg \
  -f v4l2 -standard PAL -thread_queue_size 2048 -i /dev/video1 \
  -f alsa -thread_queue_size 2048 -i hw:2,0 \
  -map 0 -map 1 \
  -vf yadif=1 \
  -vcodec libx264 -preset superfast -crf 23 -flags +global_header \
  -acodec libmp3lame -b:a 128k -ac 2 -ar 48000 \
  -f tee "vhs_output.mov|[f=nut:onfail=ignore]pipe:1" | ffplay -
  
  ```
  
  > **Comments:**
  > **username_0**: Yes, now it can encode without dropping frames using the tee object. On the other hander, the FFplay window never appeared. I've got this message "pipe:: Invalid data found when processing input" after safely exiting FFmpeg. I also notice that there are two files created. ("vhs_output.mov" and " -")  
  > **username_1**: See edited command  
  > **username_0**: Thank you, that did the trick! I hope that it can help others for similar purposes.  
  
  ---
  
  