Differences between revisions 3 and 10 (spanning 7 versions)
Revision 3 as of 2012-03-28 01:01:20
Size: 690
Editor: SamatJain
Comment:
Revision 10 as of 2012-10-05 08:32:33
Size: 1763
Editor: SamatJain
Comment: Merge WebM files
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== Rotate ==

If the camera was recording in "upside down" mode:

{{{#!highlight sh numbers=off
parallel -u 'echo {}; jpegtran -rotate 180 -perfect -copy all -outfile {}.tran {} && mv {}.tran {}' ::: *.jpg
}}}

== Resize & crop ==
Line 2: Line 12:
parallel -u 'echo {}; jpegtran -rotate 180 -perfect -copy all -outfile {}.tran {} && mv {}.tran {}' ::: *.jpg # Crop top
find . -name '*JPG' -print0 | xargs -0 -P$(nproc) -n256 gm mogrify -chop 0x486 -resize 1920x1080
# or Crop bottom
find . -name '*JPG' -print0 | xargs -0 -P$(nproc) -n256 gm mogrify -gravity South -chop 0x486 -resize 1920x1080
}}}
Line 4: Line 18:
For the GoPro HD Hero 2:

{{{#!highlight sh
Line 5: Line 22:
find . -name '*JPG' -print0 | xargs -0 -P2 -n8 mogrify -crop 2592x1944+0+486 -resize 1920x1080
# GoPro HD Hero 2
find . -name '*JPG' -print0 | xargs -0 -P2 -n8
mogrify -crop 3840x2880+0+720 -resize 1920x1080
find . -name '*JPG' -print0 | xargs -0 -P$(nproc) -n256 mogrify -crop 3840x2880+0+720 -resize 1920x1080
}}}
Line 9: Line 25:
# LDR tonemapping == LDR tone mapping ==

{{{#!highlight sh numbers=off
Line 11: Line 29:
}}}
Line 12: Line 31:
batch:

{{{
for i in $(ls); do (cd $i; parallel -u 'echo {}; ~/sys/tonemap/tonemapping ~/sys/tonemap/default.tnp {} {}.tonemapped && mv {}.tonemapped {}' ::: *.JPG); done;
}}}

== Encode to WebM ==

{{{#!highlight sh numbers=off
Line 14: Line 42:

batch:

{{{
for i in $(ls); do (cd $i; mencoder mf://*.JPG -mf fps=15:type=jpg -ovc lavc -oac lavc -of lavf -lavfopts format=webm -lavcopts threads=4:acodec=vorbis:vcodec=libvpx -ffourcc VP80 -o $(basename $(pwd)).webm); done;
}}}

== Merge WebM files ==

After placing all the WebM files in one directory, merge with:

{{{#!highlight sh numbers=off
f() { args=("$1"); shift; args+=("${@/#/+ }"); echo "${args[@]}"; }; echo mkvmerge $(f $(ls *webm))
}}}

Rotate

If the camera was recording in "upside down" mode:

parallel -u 'echo {}; jpegtran -rotate 180 -perfect -copy all -outfile {}.tran {} && mv {}.tran {}' ::: *.jpg

Resize & crop

   1 # Crop top
   2 find . -name '*JPG' -print0 | xargs -0 -P$(nproc) -n256 gm mogrify -chop 0x486 -resize 1920x1080
   3 # or Crop bottom
   4 find . -name '*JPG' -print0 | xargs -0 -P$(nproc) -n256 gm mogrify -gravity South -chop 0x486 -resize 1920x1080

For the GoPro HD Hero 2:

   1 # Crop top
   2 find . -name '*JPG' -print0 | xargs -0 -P$(nproc) -n256 mogrify -crop 3840x2880+0+720 -resize 1920x1080

LDR tone mapping

parallel -u 'echo {}; ~/sys/tonemap/tonemapping ~/sys/tonemap/default.tnp {} {}.tonemapped && mv {}.tonemapped {}' ::: *.JPG

batch:

for i in $(ls); do (cd $i; parallel -u 'echo {}; ~/sys/tonemap/tonemapping ~/sys/tonemap/default.tnp {} {}.tonemapped && mv {}.tonemapped {}' ::: *.JPG); done;

Encode to WebM

mencoder mf://*.JPG -mf fps=15:type=jpg -ovc lavc -oac lavc -of lavf -lavfopts format=webm -lavcopts threads=4:acodec=vorbis:vcodec=libvpx -ffourcc VP80 -o $(basename $(pwd)).webm

batch:

for i in $(ls); do (cd $i; mencoder mf://*.JPG -mf fps=15:type=jpg -ovc lavc -oac lavc -of lavf -lavfopts format=webm -lavcopts threads=4:acodec=vorbis:vcodec=libvpx -ffourcc VP80 -o $(basename $(pwd)).webm); done;

Merge WebM files

After placing all the WebM files in one directory, merge with:

f() { args=("$1"); shift; args+=("${@/#/+ }"); echo "${args[@]}"; }; echo mkvmerge $(f $(ls *webm))

SamatsWiki: GoPro (last edited 2017-04-14 09:43:49 by SamatJain)