Useful Stuff
Videos from MOV to MP4 with Picture-in-Picture (PIP)
When I was working on R1's RPM measurements, I found it would be easyer to show some things, instead of describing them.
So used an iPhone to tape the robot in action and the oscilloscope output.
I'm sure the video format Apple uses is excellent (I have no clue, whatsoever about video formats, etc.), but
- 12MB for 8s of video? I wouldn't call that web optimized.
Also for better demonstration:
- I wanted the two separate videos to be in one clip, using picture-in-picture.
Tools
Since I'm lacking any artistic talent, I'm not a video amateur. What was nedded is some kind of video converting and editing process that
- delivers quick results
- is easy to learn
- is cheep or free (since I will only need it a few times)
Browsing the web for something that fits and tinkering around a bit, I found a process that uses
- WinFF (version 1.5.4)
- VirtualDub (version 1.10.4)
- Virtualdub FFMpeg Input Plugin (version 1841)
- AviSynth (version 2.6.0)
Processing...
These programs have tons of functions. But what I need is pretty limited:
- We have to prepare the raw iPhone clips
I'm using VirtualDub for:
- converting from iPhone MOV format to AVI (AviSynth only handles? ... correct AVIs!)
(Open the MOV in VirtualDub and "Save As AVI...") - while we are here we also can crop the clips to the frames we want and resize them for PIP
(adding the "Video|Filter|Resize")
- converting from iPhone MOV format to AVI (AviSynth only handles? ... correct AVIs!)
- For the PIP effect I use AviSynth
You can use AviSynth as a pre-processor for VirtualDub:
- Write a *.avs file, like this one:
main = DirectShowSource(".\Robotics_R1_RPMs_TR9904_01.avi") pipm = DirectShowSource(".\Robotics_R1_RPMs_TR9904_02.avi") Overlay(main, pipm, x=640, y=360)
Where the coordinates are the upper left corner of thepipm
overlay inmain
.My numbers are based on:
main
being 1280x720pipm
being 640x360- PIP overlay in the lower right quadrant
- open the *.avs file in VirtualDub
AviSynth's result will be displayed in VirtualDub.
- While we are still in VirtualDub, we can post-process the clip (e.g. resize it, etc.).
- Save the result as AVI.
- Write a *.avs file, like this one:
- Convert to target format
With this step I ran into a few problems.
If I try to convert directly from AVI to MOV or MP4, the resulting clip had sound only, but no video.
What finally worked for me was:
- convert AVI to MPEG
c:\>ffmpeg -i Robot_Scope_overlay.avi -q:v 1 Robot_Scope.mpeg
or if you want to scale you clip in this step (like I did to 640x..., -1 keeps the aspect ratio)
c:\>ffmpeg -i Robot_Scope_overlay.avi -q:v 1 -vf scale=640:-1 Robot_Scope.mpeg
- convert MPEG to MP4 (MOV worked the same way)
c:\>ffmpeg -i Robot_Scope.mpeg Robot_Scope.mp4
My resulting MP4 video is only ~950kB for 8s.
- convert AVI to MPEG