0

I am processing my video(640 X 1280 dimensions). I want to divide my video horizontally into 2 separate videos(each video will now be 640 X 640 in dimensions),then combine them horizontally (video dimension will be now 1280 X 640)in a single video. I did the research on the internet and my issue was solved and not solved at the same time

I made a batch file and add these commands in it:-

ffmpeg -i input.mp4 -filter_complex "[0]crop=iw:ih/2:0:0[top];[0]crop=iw:ih/2:0:oh[bottom]" -map "[top]" top.mp4 -map "[bottom]" bottom.mp4
ffmpeg -i top.mp4 -i bottom.mp4 -filter_complex hstack output.mp4

Yes,my task got solved but many other issues also came out of it:-

1.) My output video has NO audio in it. No idea why there is no audio in the end results

2.) My main video file (on which I am doing all this) is 258 MB in size. But the result was only 38 MB in size. No idea what is happening? And even worse,I closely looked at the video,results were pretty same (only animation were not as smooth in output file as compared to input file)

3.) It is taking too much time(I know that computing takes some time but maybe there may be some way/sacrifice to make the process much quicker)

Thanks in advance for helping me

  • rev your command to include "copy audio" -a copy and then rev the quality by adjusting : https://stackoverflow.com/questions/3561715/using-ffmpeg-to-encode-a-high-quality-video – Robert Rowntree Feb 01 '21 at 22:23

1 Answers1

0

Combine your two commands

ffmpeg -i input.mp4 -filter_complex "[0]crop=iw:ih/2:0:0[top];[0]crop=iw:ih/2:0:oh[bottom];[top][bottom]hstack" -preset fast -c:a copy output.mp4
  • If you need it to encode faster then use a faster -preset as shown in FFmpeg Wiki: H.264.

  • x264 is a better encoder than your phone so it is not surprising that the file size is smaller.

Or use your player to do it

No need to wait for encoding. Just have your player do everything upon playback. This does not output a file, but only plays the re-arranged video. Example using mpv:

 mpv --lavfi-complex="[vid1]split[v0][v1];[v0]crop=iw:ih/2:0:0[c0];[v1]crop=iw:ih/2:0:oh[c1];[c0][c1]hstack[vo]" input.mp4
llogan
  • 121,796
  • 28
  • 232
  • 243
  • Hi. Your first method works and is double times faster. Thanks and that is more than enough for me. But when I try your second method,it says that "mpv not found"(something like that). But still your first method is perfect for me.Thanks again – Mayank Thapliyal Feb 03 '21 at 11:42
  • @MayankThapliyal You'll need to install [mpv](https://mpv.io/) if you want to use it. It's not included in your OS. – llogan Feb 03 '21 at 16:56