I have previously posted some advice about how to use VirtualDub and deshaker to get rid of the shaky video that is a feature of the Sanyo HD2000 that I use. In the intervening years, lots of other cheap HD cameras have hit the market that are even shakier. I am thinking of the GO Pros and the iPhones.
SO it is time to revisit my post - which could not get audio working.
Here is my fresh solution.
We open the file through a ffmpeg virtualdub input plugin, apply the deshaker filter once, then frameserve the second pass through avisynth proxy, to avidemux to apply final filters and compression settings.
So lets get started. To actually open the file we need VirtualDub. You don't want the portable version, so get the full fat version here:
http://virtualdub.sourceforge.net/
I have been using version 1.10.4, so anything later than that should be fine.
You simply unzip the VirtualDub-1.10.4.zip file to wherever you want, and then go into the folder. You will find a file in there called "auxsetup.exe". Run that. You want to choose the option to "Install Handler". This is going to let you frameserve out of VirtualDub. This is why you can't use the portable version, because it needs to make system changes.
Next you need to be able to open the file. I am dealing with mp4 files containing x264 and AAC streams. If ffmpeg can't decode your file, it's officially weird. There is a very useful plugin for virtualdub which lets you open any file that ffmpeg can access. You can download it here:
http://sourceforge.net/projects/virtualdubffmpeginputplugin/
Again, you just need to unzip the VirtualdubFFMpegPlugin_0817.zip that results. You end up with two folders and a readme. Copy the contents of the plugins32 folder into the plugins32 folder in your virtualdub installation folder. You need to include the "ffdlls" sub-folder.
So far, so good. You can now test your system by running virtualdub, and trying to open your mp4 file. Hopefully that should work. You can further test the system by choosing the file menu, and "Start Frame server...". In the dialogue box that follows, just choose "Start". You will not be running multiple frameservers, but if you are here is where you would give them individual names. In the next window, you need to name your placeholder file. This is the signpost that avisynth is going to open to access the frameserved data. I name my file "frameserver.vdr" and stick it in a temp folder. It's tiny. Once you save this, virtualdub shrinks down to a frameserver info window, with the only option to "Stop Frameserving".
Next, open a new instance of virtualdub, and try to open the frameserver.vdr file. This should work, and should give you access to the data. You should be able to see the counters change on the info window as you browse through the file.
You might be able to open this .vdr file directly in avidemux, or any other encoder of your choice. If so, best of luck you you. I couldn't. Even when I renamed it to "frameserver.avs", which is the avisynth file type.
Tune in next time for more hilarious adventure of how to deshoogle!
Showing posts with label ffmpeg. Show all posts
Showing posts with label ffmpeg. Show all posts
Thursday, 11 September 2014
Friday, 23 December 2011
Formatting Video for iPad
This, I have to say, has been one of the most gratifying things to work out in my entire experience of working stuff out. The iPad is an excellent device for consuming media, especially video. The problem is getting video in a format suitable for the iPad without forking over dosh to Apple.
The best I have been able to come up with to date is Handbrake, which has built in modes for the iPad. What it doesn't do is batch convert a whole directory to iPad format.
So joy of joys, I present the Ubuntu commands necessary for this (assuming you have installed the requisite packages all of which are listed in my how to build a custom Live CD posts).
You fill in the details between the quotes at the beginning, copy and paste the code into a command line in a directory containing video files of type .input_extension and it will convert all the files to .mp4 suitable for playing on an iPad. All files will have exactly the same resolution and bitrate, which may not be desirable, so check in advance by examining your files.
You can change the target bitrate to whatever you like, within reason, and the iPad will still play the files. You will want to carefully check the aspect ratio of the files going in to make sure that these settings work. If they start in 16:9 this will spit them out in 16:9 at 1024x576. 4:3 files will need the target_resolution changed to "1024x768" for instance.
Don't make the mistake I made of running several instances of this command at the same time - because they will overwrite each others variables.
As a bonus, here are the commands necessary to extract audio from a clip in an iPod/iPhone friendly format:
Same rules apply.
The best I have been able to come up with to date is Handbrake, which has built in modes for the iPad. What it doesn't do is batch convert a whole directory to iPad format.
So joy of joys, I present the Ubuntu commands necessary for this (assuming you have installed the requisite packages all of which are listed in my how to build a custom Live CD posts).
target_resolution="1024x576" &&
target_bitrate="2.5M" &&
minimum_bitrate="0k" &&
maximum_bitrate="3.5M" &&
audio_bitrate="256k" &&
audio_sample_rate="48000" &&
audio_channels="2" &&
input_extension="mkv" &&
number_of_threads="8" &&
for file in *.$input_extension; do \
ffmpeg -y -i "$file" \
-pass 1 -f mp4 \
-s $target_resolution -vcodec libx264 -threads $number_of_threads -b $target_bitrate \
-bt 100k -maxrate $maximum_bitrate -minrate $minimum_bitrate -bufsize 2M \
-flags2 +mixed_refs -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 2 -refs 2 -coder 0 -me_method umh -me_range 90 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 \
-rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -g 90 -an /dev/null && \
ffmpeg -y -i "$file" \
-pass 2 -f mp4 \
-acodec libfaac -ar $audio_sample_rate -ab $audio_bitrate -ac $audio_channels \
-s $target_resolution -vcodec libx264 -threads 8 -async 2205 -b $target_bitrate \
-bt 100k -maxrate $maximum_bitrate -minrate $minimum_bitrate -bufsize 2M \
-flags2 +mixed_refs -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 2 -refs 2 -coder 0 -me_method umh -me_range 90 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 \
-rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -g 90 \
"${file%.$input_extension}.mp4" \
; done
You fill in the details between the quotes at the beginning, copy and paste the code into a command line in a directory containing video files of type .input_extension and it will convert all the files to .mp4 suitable for playing on an iPad. All files will have exactly the same resolution and bitrate, which may not be desirable, so check in advance by examining your files.
You can change the target bitrate to whatever you like, within reason, and the iPad will still play the files. You will want to carefully check the aspect ratio of the files going in to make sure that these settings work. If they start in 16:9 this will spit them out in 16:9 at 1024x576. 4:3 files will need the target_resolution changed to "1024x768" for instance.
Don't make the mistake I made of running several instances of this command at the same time - because they will overwrite each others variables.
As a bonus, here are the commands necessary to extract audio from a clip in an iPod/iPhone friendly format:
audio_bitrate="128k" &&
audio_sample_rate="48000" &&
audio_channels="2" &&
input_extension="flv" &&
for file in *.$input_extension; do \
ffmpeg -y -i "$file" -vn \
-acodec libfaac -ar $audio_sample_rate -ab $audio_bitrate -ac $audio_channels \
"${file%.$input_extension}.m4a" \
; done
Same rules apply.
Subscribe to:
Posts (Atom)