Convert Horizontal Videos into Vertical using FFmpeg and GPT-4

Follow the steps and examples below to convert horizontal videos into vertical format using FFmpeg and GPT-4.

🎥 See how it works

1. Install Ffmpeg

2. Install WhisperX

3. Generate .tsv transcription file

📋 Copy
whisperx {your_video.mov} --output_dir {your_output_directory/} --output_type all --model medium.en

4. Prompt

📋 Copy
            Lets create {clip_count} clips of interesting content from {file_path}.

Using ffmpeg and this .tsv file:

{tsv_file}

Follow these rules:

- Create {clip_count} calls to ffmpeg with interesting content based on the start + end + text, of the .tsv file. 
- Each clip should contain a concise idea, it should make sense to a viewer.
- Clips should complete where text ends with a period.
- The start, end columns are in milliseconds. That means 7760 -> 00:00:07.760, 42740 -> 00:00:42.740, 164338 -> 00:02:44.338, 421638 -> 00:07:01.638, etc.
- Create clips with a duration between 20 and 45 seconds.
- Don't create clips that exceed the length of {video_length}. Start + duration must be less than {video_length}.

Here's an example of output: 

ffmpeg -noaccurate_seek -ss 00:00:0.0 -i "{file_path}" -t 00:00:05.0 -c copy "{file_output_path}/clip1_{file_name}"
ffmpeg -noaccurate_seek -ss 00:00:10.5 -i "{file_path}" -t 00:00:08.0 -c copy "{file_output_path}/clip2_{file_name}"
ffmpeg -noaccurate_seek -ss 00:00:4.5 -i "{file_path}" -t 00:00:10.5 -c copy "{file_output_path}/clip3_{file_name}"

        

5. Prompt Full Example

📋 Copy
            Lets create 5 clips of interesting content from /Users/ravix/Desktop/master-disruption.mov.

Using ffmpeg and this .tsv file:

start	end	text
121	3520	Industry disruption is a tale as old as time.
4361	9120	Once there were two owners of delivery services that used horses to transport
10140	11157	goods. The first,
11500	16340	John had been in the business for over a decade and he knew the ins and outs of
16741	18999	horse drawn carriages. As an expert,
19180	23799	he was reluctant to change his ways as automobiles began to emerge.
24261	25319	The second business owner,
25520	30239	Sarah saw the potential and the new technology and decided to invest in
30521	34700	automobiles for her business. You already know where this is going.
34840	39340	As time went on, Sarah's business grew rapidly while John's declined.
39740	44080	Customers were drawn to the speed and efficiency of Sarah's automobile
44120	48640	deliveries. Sarah was able to transport more goods in less time.
48820	53760	She was able to do more with less while John's business declined and eventually
54260	58499	he had to close shop. It also became more difficult for John to find work.
58700	62219	His knowledge of horse drawn carriages became obsolete.
62700	67600	This deceptively simple story has three timeless principles hidden within it.
67840	72400	And this video will parallel the automobile revolution to the air revolution
72440	74719	that's happening right now. As you're watching this video,
74961	75919	as I'm filming this video,
76080	80380	we'll discuss these three timeless principles that you can use to filter out the
80480	83539	noise and the signal in the revolution.
83801	87559	My name is Dan. I have a decade's worth of software engineering experience.
87740	91840	I'm currently working full time at an artificial intelligence startup working in
91880	94759	the real estate space. When I'm not working on that startup,
94901	95919	I'm working to build my own.
96100	99499	I spend almost all my free time indie hacking and building software.
99861	102539	Right now I'm in the process of becoming Sarah.
102840	107800	I've just finished building a GPT powered notion auto tweeting application.
108140	111219	This application automatically generates and sends tweets.
111500	115019	All I do is curate the tweets by rejecting or proving them.
115300	119480	I built this in less than eight hours total and I built the whole thing here on
119540	122100	YouTube in public. Feel free to check out those videos.
122200	126440	If you're interested to see what you can do with the new AI technology that's
126480	130519	coming out now. These three principles is what helped me to learn, build,
130760	134800	and share these new AI technologies. If you use these principles the right way,
134840	137640	they'll point you to what you should be focusing on and what you should be
137680	140200	ignoring. With the rise of AI generated content,
140260	143859	we're going to see a lot of noise. So being principled is key.
144541	148179	Run in not out. This is a fire sale,
148781	152239	not a fire. Disruption favors, flexible,
152761	154918	fast moving risk takers.
155280	158059	Sarah took a risk in adopting this new technology.
158260	163200	That risk and the flexibility of her business is what led to the positive upside
163620	167879	she received by joining the automobile revolution early.
168140	172239	To succeed with AI, you need to be running into these technologies.
172440	175059	If you've clicked on this video, you've already heard them all.
175580	179420	Chad GPT, llama, GPT, three GPT, four chat,
179460	183599	GPT plugins barred freaking being Dolly mid journey.
183880	187159	The list goes on and on and on. I want you to imagine this right now.
187460	191959	You don't want to be the guy in the forest cutting down trees to build his home
192400	196179	with an ax while everyone around you is using chainsaws.
196480	199218	That brings us to principle two more with less.
199880	204539	Sarah was able to do more by adopting the new technologies available to her
205303	205715	quickly.
205940	209819	The speed in which you adopt these new technologies will elongate the gap
210100	214300	between you and the time it takes for everyone else to catch up.
214701	216258	When you adopt matters.
216620	220679	If you spot a tool or technology that allows you to do more with less,
221241	223379	allows you to create more with less time,
223700	226280	allows you to generate more output with less input,
226401	229219	you found a lever. When you activate this lever,
229920	232939	it gives you more than the guy standing next to you,
233521	235439	pulling the same type of lever.
236260	240879	The only difference is your lever has 10 times the output as you're running in
241201	242818	and looking through AI technologies,
243460	248059	focus on the tools and the technology that allows you to do more with less.
248622	251200	30 minutes of work in two hours of output,
251320	255779	five lines of texts created a whole blog for code completions,
257221	259719	four functions written, run a single script,
261322	262999	scaffold an entire application.
263380	267780	These are just a few examples of scaling your impact and focusing on doing more
267963	268419	with less.
268460	272099	This single principle can take you to the moon and beyond during the noise of
272300	274279	the AI boom focus on tools,
274440	277679	technology and ideas that allow you to do more with less.
277980	282520	A lot of the AI technology coming out right now is just a bunch of UI wrappers
282681	285060	around chat GPT. And although that's fantastic,
285201	286298	and there's value in that,
287121	289638	it's not going to allow you to do a ton more with less.
290300	293319	The big winners will emerge. Focus on this principle,
293560	297379	and you'll know when these winners emerge, bet on always.
297800	301279	People always want better, faster, cheaper,
301801	304979	social connecting, engaging products.
305340	307799	These are things you can place massive bets on.
308220	311079	So as the slew of AI technology comes out,
311220	313818	focus on not just getting more with less,
314080	318599	but focus on the fundamental human value behind the
318820	321459	technology or tool. Here are some more examples.
321560	326079	People always want lower prices. People always want faster solutions.
326420	330239	People always want more control. People always want additional comfort.
330360	334719	People always want entertainment. People always want less collateral damage,
335000	337298	less risk. People always want social status.
337620	339859	People always want confidence and trust.
340241	342518	The AI industry is blowing up right now,
343001	347580	and it can be really hard to stay focused and not get super nervous and worried
347741	350939	about job security, about what to build next,
351321	354020	about what tools are important, about what tools aren't.
354180	357219	But I'm hoping that by engaging with these three principles,
357700	362500	you have an edge and you can think and be more like a Sarah versus a
362601	364899	John. Run in, not out.
365841	369859	More with less bet on always.
370221	371737	I just want to leave you with these final thoughts.
372740	376939	Remember that in every technological disruption, there are people who resist.
377220	379940	There are people who don't want to move forward.
380000	382036	There are people who don't want the change because why?
383040	387419	Because the disruption disrupts them. It disrupts their comfortable,
387900	392299	continuous habits, their way of life, their expertise.
393623	394496	And remember,
395240	399879	just like John understood everything about horse carriages, he was the expert.
400180	402759	None of that mattered during the automobile revolution.
402980	406959	Beware of turning into an old dog that can't learn new tricks,
407240	408679	especially in the software industry.
408780	412099	I really liked this format where I build in public.
412641	416100	I write every line of code from scratch and I post it on YouTube.
416120	418659	You guys can see all of it. You can see the whole journey.
419181	421639	And then I cap it off with a video like this,
421920	426200	where I talk about what we've built, where I kind of, you know,
426321	429860	make it relevant to the overall narrative of the software industry to help you
430000	434319	level set the things you might be building or thinking or learning with
435021	436279	what someone else might be building.
436500	438669	I am 300% all in on AI technology.
442261	445600	My plan is to become an AI engineer and I want to take you along the journey
445640	448959	with me. With all of his knowledge, John was disrupted.
449802	451318	Sarah was a disruptor.
451560	455299	Remember when you're feeling that sense of resistance to new things,
456000	460640	ask yourself, do I want to be a Sarah or do I want to be a John?
461000	464579	Thanks for watching. Drop a like, subscribe, stay focused,
465480	467699	keep building, and I'll see you in the next one.


Follow these rules:

- Create 5 calls to ffmpeg with interesting content based on the start + end + text, of the .tsv file. 
- Each clip should contain a concise idea, it should make sense to a viewer.
- Clips should complete where text ends with a period.
- The start, end columns are in milliseconds. That means 7760 -> 00:00:07.760, 42740 -> 00:00:42.740, 164338 -> 00:02:44.338, 421638 -> 00:07:01.638, etc.
- Create clips with a duration between 20 and 45 seconds.
- Don't create clips that exceed the length of 00:07:47.967. Start + duration must be less than 00:07:47.967.

Here's an example of output: 

ffmpeg -noaccurate_seek -ss 00:00:0.0 -i "/Users/ravix/Desktop/master-disruption.mov" -t 00:00:05.0 -c copy "output/clips/master-disruption/clip1_master-disruption.mov"
ffmpeg -noaccurate_seek -ss 00:00:10.5 -i "/Users/ravix/Desktop/master-disruption.mov" -t 00:00:08.0 -c copy "output/clips/master-disruption/clip2_master-disruption.mov"
ffmpeg -noaccurate_seek -ss 00:00:4.5 -i "/Users/ravix/Desktop/master-disruption.mov" -t 00:00:10.5 -c copy "output/clips/master-disruption/clip3_master-disruption.mov"