Answers.Body: <p>I finally found out how to do it! </p>
  
  <pre><code>ffmpeg -f concat -safe 0 -i VIDEOFILES.txt -filter_complex  \
   "[0:v] fps=32, scale=1920:1080, vflip, hflip, setpts=0.25*PTS, fifo [v0]; \
    [0:v] fps=32, scale=1920:1080, vflip, hflip, setpts=0.25*PTS, fifo [v1];  
    [v0][v1]concat=n=2:v=1[out]" -map "[out]" -crf 14  -vcodec libx264  -vb 20M  -loglevel error  video_out_01.avi
  </code></pre>
  
  <ul>
  <li>concat: concetrate files </li>
  <li>VIDEOFILES.txt: video files with path
  included, eg. file '/path/a.mp4' (including file) </li>
  <li>fps=32, scale=1920:1080: drop to 32 frames, and reducing video resolution</li>
  <li>vflip, hflip: 180 degrees rotation of the video  </li>
  <li>setpts=0.25*PTS: Four times speeder  </li>
  <li>fifo: a ffmpeg filter that it says to wait frame
  to be fully processed before it is given to the next process --- due
  to some filter process frame quicker than others e.g. due to frame
  drop (?)</li>
  <li>crf 14: High quality ensured (0 = uncompressed)</li>
  <li>vcodec libx264: codec to compress the video file</li>
  <li>vb 20M: video bitrate (a high one)</li>
  <li>loglevel error: ffmpeg output information only errors will be displayed</li>
  </ul>
  
  <p>BIG Questions:</p>
  
  <p>A) I tried to reverse the order of filters eg. 
  <code>[0:v] setpts=0.25*PTS, fps=32, scale=1920:1080, vflip, hflip,  fifo [v0]</code>
  However, it was extremely low. 
  The commands are executed seriasly? Then, why I must recode every frame, when only 1/4 of them will be kept? How can I do that in order to gain recoding speed? </p>
  
  <p>B) Why I need FIFO eventually. This must be not the default behavior? All frames that are kept must be processed from all filters! Right? Why then ffmpeg drop frames without being processed? this is the meaning of FIFO? Right? </p>
  
  <p>UPDATE: ffmpeg 4.2.3 freezes when multiple video files exist e.g. >5</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-14T12:20:21.310Z
Answers.Text: I am still looking for a solution
Answers.UserDisplayName: Estatistics
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-13T11:00:51.500Z
Answers.LastActivityDate: 2020-06-14T12:19:45.967Z
Answers.LastEditDate: 2020-06-14T12:19:45.967Z
Answers.UserDisplayName: Estatistics
Body: <p>How to Merge Multiple MP4 videofiles using concat while transposing 180o two MP4 videofiles?</p>
  
  <p>Currently, i am using the following ffmpeg (concat) command: </p>
  
  <pre><code>ffmpeg -f concat -safe 0 -i VIDEOFILES.txt -r 32 -crf 14  -vcodec libx264 -vb 20M -vf "scale=1280:720,setpts=0.25*PTS" -fflags +genpts  -an   video_output_01.avi
  </code></pre>
  
  <p>How can I, in the same time, transpose two MP4 files 180 degrees? </p>
  
  <p>Note that i used the following HEX code hack <a href="https://stackoverflow.com/questions/25031557/rotate-mp4-videos-without-re-encoding">HERE</a> "True lossless rotation of MP4:
  " to rotate MP4 video files 180 degrees but ffmpeg ignored that information during encoding time!</p>
  
  <p>What I can do?</p>
  
Tags: <ffmpeg><mp4>
Title: How to Merge Multiple MP4 videofiles using concat of ffmpeg while transposing 180 degrees two MP4 videofiles
UserDisplayName: Estatistics
ThreadText: # How to Merge Multiple MP4 videofiles using concat of ffmpeg while transposing 180 degrees two MP4 videofiles
  
  (Asked by: username_0 on 2020-06-13)
  
  How to Merge Multiple MP4 videofiles using concat while transposing 180o two MP4 videofiles?
  
  Currently, i am using the following ffmpeg (concat) command:
  
  ```
  ffmpeg -f concat -safe 0 -i VIDEOFILES.txt -r 32 -crf 14  -vcodec libx264 -vb 20M -vf "scale=1280:720,setpts=0.25*PTS" -fflags +genpts  -an   video_output_01.avi
  
  ```
  
  How can I, in the same time, transpose two MP4 files 180 degrees?
  
  Note that i used the following HEX code hack [HERE](https://stackoverflow.com/questions/25031557/rotate-mp4-videos-without-re-encoding) "True lossless rotation of MP4:
  " to rotate MP4 video files 180 degrees but ffmpeg ignored that information during encoding time!
  
  What I can do?
  
  **Tags:** ffmpeg, mp4
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-06-13. Score: 1
  
  I finally found out how to do it!
  
  ```
  ffmpeg -f concat -safe 0 -i VIDEOFILES.txt -filter_complex  \
   "[0:v] fps=32, scale=1920:1080, vflip, hflip, setpts=0.25*PTS, fifo [v0]; \
    [0:v] fps=32, scale=1920:1080, vflip, hflip, setpts=0.25*PTS, fifo [v1];  
    [v0][v1]concat=n=2:v=1[out]" -map "[out]" -crf 14  -vcodec libx264  -vb 20M  -loglevel error  video_out_01.avi
  
  ```
  
  * concat: concetrate files
  * VIDEOFILES.txt: video files with path
    included, eg. file '/path/a.mp4' (including file)
  * fps=32, scale=1920:1080: drop to 32 frames, and reducing video resolution
  * vflip, hflip: 180 degrees rotation of the video
  * setpts=0.25\*PTS: Four times speeder
  * fifo: a ffmpeg filter that it says to wait frame
    to be fully processed before it is given to the next process --- due
    to some filter process frame quicker than others e.g. due to frame
    drop (?)
  * crf 14: High quality ensured (0 = uncompressed)
  * vcodec libx264: codec to compress the video file
  * vb 20M: video bitrate (a high one)
  * loglevel error: ffmpeg output information only errors will be displayed
  
  BIG Questions:
  
  A) I tried to reverse the order of filters eg.
  `[0:v] setpts=0.25*PTS, fps=32, scale=1920:1080, vflip, hflip, fifo [v0]`
  However, it was extremely low.
  The commands are executed seriasly? Then, why I must recode every frame, when only 1/4 of them will be kept? How can I do that in order to gain recoding speed?
  
  B) Why I need FIFO eventually. This must be not the default behavior? All frames that are kept must be processed from all filters! Right? Why then ffmpeg drop frames without being processed? this is the meaning of FIFO? Right?
  
  UPDATE: ffmpeg 4.2.3 freezes when multiple video files exist e.g. >5
  
  > **Comments:**
  > **username_0**: I am still looking for a solution  
  
  ---
  
  