SlideShare a Scribd company logo
1 of 14
Applied Shell Scripting
Shoaib Sufi
(part of assignment 5.5 SWC instructors course)
Background
• SWC instructors course
• 10 minutes of instruction (maybe more)
• Feedback
• About novice to competence (not expertise)
• Thanks for taking the time
Motivation
• To use shell scripting skills learned
• To build something interesting …
• …. That is open for iterative improvement
• Try to follow the data driven research cycle
– Build dataset
– Process data
– analyse results (in this example we only display)
• Area of investigation
• Scenic webcam stills to a time-lapse video
Caveats
• Not the clearest webcam
– Perhaps more interesting to try to improve
• Not the most perfect of scripts
– Future steps might include functions/config etc.
• Not using version control
– An example for github left for the user
• As said earlier this is a system that can be
iteratively improved
• Aimed at someone who knows the basic scripting
commands and interested to see it in practice
The Webcam – Snowdon, Wales, UK
http://www.fhc.co.uk/weather/images/sn_huge.jpg
Building a dataset
• Script
#!/bin/bash
while [ 1 -lt 3 ]
do
curl -o sn_huge_`date +%F-%T`.jpg http://www.fhc.co.uk/weather/images/sn_huge.jpg
sleep 60
done
• Running as a background task
#get_data.sh
#Ctrl-z
#bg %1
Stage files
• To a working directory – preserve dataset
#mkdir working-dir
#cp *.jpg working-dir
Clean files 1 – rem duff html files
• Remove duff html
for i in `ls *.jpg`
do
rm `file $i | grep HTML | cut -d":" -f1,2,3` 2&1 > /dev/null
done
Clean files 2 - duplicates
#!/bin/bash
# running this script twice should not produce any 'is a duplicate' output
declare -a SHA1BEFORE
count=0
current_sum_is_duplicate=0
#for all of the files that are pictures
for i in `ls *.jpg`
do
#get the sha1 sum of the current file
sum=`sha1sum $i | cut -d" " -f1`
echo sha1sum of file $i is $sum
#if sha1sum seen before then delete the file as it's a duplicate
for j in ${SHA1BEFORE[@]}
do
if [ $sum == $j ]
then
echo $i is a duplicate and will be deleted
rm $i
current_sum_is_duplicate=1
break
fi
done
#collect sha1sums if not seen before (if you collect all comparisons will slow down quicker)
if [ $current_sum_is_duplicate == 0 ]
then
SHA1BEFORE[$count]=$sum
count=$(( $count + 1 ))
fi
# reset the sha1sum seen before flag
current_sum_is_duplicate=0
done
Rename file
• To allow avconv to work
#!/bin/bash
count=1
#for all of the files that are pictures
for i in `ls *.jpg`
do
cp $i filename_${count}.jpg
count=$(( $count + 1 ))
done
Making the video
#!/bin/bash
avconv -i filename_%d.jpg -q:v 1 -aspect:v 4:3 output.mp4
# some problems/solutions – default command actions not always best
# video quality seems poor - blocky in parts [fixed -q:v 1 -v is the stream
specifier which is the video in this case]
# image seems stretched - i.e. not same aspect ratio as images - seems
widescreen [fixed with -aspect:v 4:3]
# not sure why frames are being dropped during encoding and no matter
what frame rate I choose the video seems to be the same length in time
to play – weird
An Example video
• Post on vimeo ?
Further directions
(aim:to get a nice as video as possible from stills)
• Histogram – flicker
– Could be a simple fix for files over 100K
– Nicer to do mathematically/analytically
• Lots of red green colour noise
– How much can this be reduced without decreasing
image sharpness
• Would morphing make for a better video
– Worth exploring maybe
• Investigate better encoder
– Better quality and smaller filesize
Research ?
• Possible research questions
– Anything useful about
• Erosion
• Weather
• Sunrise/sunset time detection – possible cf. HMNAO times
• Contentions
– Perhaps it’s all been done before
– Should have done a literature review
• Still useful and fun
– Applied to a nice task
– Lot’s of room for iterative improvement
• Better scripts, version control
• Interesting problems to fix (as mentioned in further directions)

More Related Content

Viewers also liked

Health policies in u.s.a
Health policies in u.s.aHealth policies in u.s.a
Health policies in u.s.aAmal Abuown
 
Evaluation
EvaluationEvaluation
Evaluationarifmo
 
Elektricno jastuce euromarket
Elektricno jastuce euromarketElektricno jastuce euromarket
Elektricno jastuce euromarketMladen Brkic
 
Pert 4 struktur dan organisasi tubuh hewan
Pert 4 struktur dan organisasi tubuh hewanPert 4 struktur dan organisasi tubuh hewan
Pert 4 struktur dan organisasi tubuh hewanNanda Reda
 
První středa s H1.cz: emailing
První středa s H1.cz: emailingPrvní středa s H1.cz: emailing
První středa s H1.cz: emailingStartupClub
 
Communities in schools albany:dougherty
Communities in schools albany:dougherty Communities in schools albany:dougherty
Communities in schools albany:dougherty Femi Anderson
 
Պահպանենք բնությունը
Պահպանենք բնությունըՊահպանենք բնությունը
Պահպանենք բնությունըnarineharutyunyan
 
CEAT RADIAL MARKET STUDY
CEAT RADIAL MARKET STUDYCEAT RADIAL MARKET STUDY
CEAT RADIAL MARKET STUDYMAINAK SAHA
 
Զատկական խնդրագիրք
Զատկական խնդրագիրքԶատկական խնդրագիրք
Զատկական խնդրագիրքnarineharutyunyan
 

Viewers also liked (20)

Presentation2
Presentation2Presentation2
Presentation2
 
Health policies in u.s.a
Health policies in u.s.aHealth policies in u.s.a
Health policies in u.s.a
 
Մադագասկար
ՄադագասկարՄադագասկար
Մադագասկար
 
Evaluation
EvaluationEvaluation
Evaluation
 
penyakit Flu babi
penyakit Flu babipenyakit Flu babi
penyakit Flu babi
 
Elektricno jastuce euromarket
Elektricno jastuce euromarketElektricno jastuce euromarket
Elektricno jastuce euromarket
 
Kelompok 11
Kelompok 11Kelompok 11
Kelompok 11
 
Pert 4 struktur dan organisasi tubuh hewan
Pert 4 struktur dan organisasi tubuh hewanPert 4 struktur dan organisasi tubuh hewan
Pert 4 struktur dan organisasi tubuh hewan
 
Ռեհան
ՌեհանՌեհան
Ռեհան
 
První středa s H1.cz: emailing
První středa s H1.cz: emailingPrvní středa s H1.cz: emailing
První středa s H1.cz: emailing
 
Communities in schools albany:dougherty
Communities in schools albany:dougherty Communities in schools albany:dougherty
Communities in schools albany:dougherty
 
Slide share
Slide shareSlide share
Slide share
 
Me gusta
Me gustaMe gusta
Me gusta
 
Պահպանենք բնությունը
Պահպանենք բնությունըՊահպանենք բնությունը
Պահպանենք բնությունը
 
Ntf
NtfNtf
Ntf
 
CEAT RADIAL MARKET STUDY
CEAT RADIAL MARKET STUDYCEAT RADIAL MARKET STUDY
CEAT RADIAL MARKET STUDY
 
Perk lansia
Perk lansiaPerk lansia
Perk lansia
 
Tutorial c panel
Tutorial c panelTutorial c panel
Tutorial c panel
 
Enzim fix
Enzim fixEnzim fix
Enzim fix
 
Զատկական խնդրագիրք
Զատկական խնդրագիրքԶատկական խնդրագիրք
Զատկական խնդրագիրք
 

Similar to Applied Shell Scripting - stills to time-lapse

Why internal pen tests are still fun
Why internal pen tests are still funWhy internal pen tests are still fun
Why internal pen tests are still funpyschedelicsupernova
 
Ruby performance - The low hanging fruit
Ruby performance - The low hanging fruitRuby performance - The low hanging fruit
Ruby performance - The low hanging fruitBruce Werdschinski
 
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...srisatish ambati
 
2.4 Optimizing your Visual COBOL Applications
2.4   Optimizing your Visual COBOL Applications2.4   Optimizing your Visual COBOL Applications
2.4 Optimizing your Visual COBOL ApplicationsMicro Focus
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance DrupalJeff Geerling
 
Experience with jemalloc
Experience with jemallocExperience with jemalloc
Experience with jemallocKit Chan
 
Hosting Drupal on Amazon EC2
Hosting Drupal on Amazon EC2Hosting Drupal on Amazon EC2
Hosting Drupal on Amazon EC2Kornel Lugosi
 
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)Tim Bunce
 
Docker 102 - Immutable Infrastructure
Docker 102 - Immutable InfrastructureDocker 102 - Immutable Infrastructure
Docker 102 - Immutable InfrastructureAdrian Otto
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009pratiknaik
 
ITCamp 2013 - Tobiasz Koprowski - 2AM A Disaster Just Began
ITCamp 2013 - Tobiasz Koprowski - 2AM A Disaster Just BeganITCamp 2013 - Tobiasz Koprowski - 2AM A Disaster Just Began
ITCamp 2013 - Tobiasz Koprowski - 2AM A Disaster Just BeganITCamp
 
KoprowskiT_it_camp2013 - 2amADisasterJustBegan
KoprowskiT_it_camp2013 - 2amADisasterJustBeganKoprowskiT_it_camp2013 - 2amADisasterJustBegan
KoprowskiT_it_camp2013 - 2amADisasterJustBeganTobias Koprowski
 
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...Christy Norman
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...Docker, Inc.
 
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in Perl
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in PerlNagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in Perl
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in PerlNagios
 
Understanding Elastic Block Store Availability and Performance
Understanding Elastic Block Store Availability and PerformanceUnderstanding Elastic Block Store Availability and Performance
Understanding Elastic Block Store Availability and PerformanceAmazon Web Services
 
Building Faster Websites
Building Faster WebsitesBuilding Faster Websites
Building Faster WebsitesCraig Walker
 
Python VS GO
Python VS GOPython VS GO
Python VS GOOfir Nir
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)Nexcess.net LLC
 

Similar to Applied Shell Scripting - stills to time-lapse (20)

Why internal pen tests are still fun
Why internal pen tests are still funWhy internal pen tests are still fun
Why internal pen tests are still fun
 
Ruby performance - The low hanging fruit
Ruby performance - The low hanging fruitRuby performance - The low hanging fruit
Ruby performance - The low hanging fruit
 
Give A Great Tech Talk 2013
Give A Great Tech Talk 2013Give A Great Tech Talk 2013
Give A Great Tech Talk 2013
 
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...
 
2.4 Optimizing your Visual COBOL Applications
2.4   Optimizing your Visual COBOL Applications2.4   Optimizing your Visual COBOL Applications
2.4 Optimizing your Visual COBOL Applications
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance Drupal
 
Experience with jemalloc
Experience with jemallocExperience with jemalloc
Experience with jemalloc
 
Hosting Drupal on Amazon EC2
Hosting Drupal on Amazon EC2Hosting Drupal on Amazon EC2
Hosting Drupal on Amazon EC2
 
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
 
Docker 102 - Immutable Infrastructure
Docker 102 - Immutable InfrastructureDocker 102 - Immutable Infrastructure
Docker 102 - Immutable Infrastructure
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009
 
ITCamp 2013 - Tobiasz Koprowski - 2AM A Disaster Just Began
ITCamp 2013 - Tobiasz Koprowski - 2AM A Disaster Just BeganITCamp 2013 - Tobiasz Koprowski - 2AM A Disaster Just Began
ITCamp 2013 - Tobiasz Koprowski - 2AM A Disaster Just Began
 
KoprowskiT_it_camp2013 - 2amADisasterJustBegan
KoprowskiT_it_camp2013 - 2amADisasterJustBeganKoprowskiT_it_camp2013 - 2amADisasterJustBegan
KoprowskiT_it_camp2013 - 2amADisasterJustBegan
 
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
A to Z of a Multi-platform Docker Swarm: Building, Shipping, and Running Mult...
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
 
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in Perl
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in PerlNagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in Perl
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in Perl
 
Understanding Elastic Block Store Availability and Performance
Understanding Elastic Block Store Availability and PerformanceUnderstanding Elastic Block Store Availability and Performance
Understanding Elastic Block Store Availability and Performance
 
Building Faster Websites
Building Faster WebsitesBuilding Faster Websites
Building Faster Websites
 
Python VS GO
Python VS GOPython VS GO
Python VS GO
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 

Recently uploaded (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 

Applied Shell Scripting - stills to time-lapse

  • 1. Applied Shell Scripting Shoaib Sufi (part of assignment 5.5 SWC instructors course)
  • 2. Background • SWC instructors course • 10 minutes of instruction (maybe more) • Feedback • About novice to competence (not expertise) • Thanks for taking the time
  • 3. Motivation • To use shell scripting skills learned • To build something interesting … • …. That is open for iterative improvement • Try to follow the data driven research cycle – Build dataset – Process data – analyse results (in this example we only display) • Area of investigation • Scenic webcam stills to a time-lapse video
  • 4. Caveats • Not the clearest webcam – Perhaps more interesting to try to improve • Not the most perfect of scripts – Future steps might include functions/config etc. • Not using version control – An example for github left for the user • As said earlier this is a system that can be iteratively improved • Aimed at someone who knows the basic scripting commands and interested to see it in practice
  • 5. The Webcam – Snowdon, Wales, UK http://www.fhc.co.uk/weather/images/sn_huge.jpg
  • 6. Building a dataset • Script #!/bin/bash while [ 1 -lt 3 ] do curl -o sn_huge_`date +%F-%T`.jpg http://www.fhc.co.uk/weather/images/sn_huge.jpg sleep 60 done • Running as a background task #get_data.sh #Ctrl-z #bg %1
  • 7. Stage files • To a working directory – preserve dataset #mkdir working-dir #cp *.jpg working-dir
  • 8. Clean files 1 – rem duff html files • Remove duff html for i in `ls *.jpg` do rm `file $i | grep HTML | cut -d":" -f1,2,3` 2&1 > /dev/null done
  • 9. Clean files 2 - duplicates #!/bin/bash # running this script twice should not produce any 'is a duplicate' output declare -a SHA1BEFORE count=0 current_sum_is_duplicate=0 #for all of the files that are pictures for i in `ls *.jpg` do #get the sha1 sum of the current file sum=`sha1sum $i | cut -d" " -f1` echo sha1sum of file $i is $sum #if sha1sum seen before then delete the file as it's a duplicate for j in ${SHA1BEFORE[@]} do if [ $sum == $j ] then echo $i is a duplicate and will be deleted rm $i current_sum_is_duplicate=1 break fi done #collect sha1sums if not seen before (if you collect all comparisons will slow down quicker) if [ $current_sum_is_duplicate == 0 ] then SHA1BEFORE[$count]=$sum count=$(( $count + 1 )) fi # reset the sha1sum seen before flag current_sum_is_duplicate=0 done
  • 10. Rename file • To allow avconv to work #!/bin/bash count=1 #for all of the files that are pictures for i in `ls *.jpg` do cp $i filename_${count}.jpg count=$(( $count + 1 )) done
  • 11. Making the video #!/bin/bash avconv -i filename_%d.jpg -q:v 1 -aspect:v 4:3 output.mp4 # some problems/solutions – default command actions not always best # video quality seems poor - blocky in parts [fixed -q:v 1 -v is the stream specifier which is the video in this case] # image seems stretched - i.e. not same aspect ratio as images - seems widescreen [fixed with -aspect:v 4:3] # not sure why frames are being dropped during encoding and no matter what frame rate I choose the video seems to be the same length in time to play – weird
  • 12. An Example video • Post on vimeo ?
  • 13. Further directions (aim:to get a nice as video as possible from stills) • Histogram – flicker – Could be a simple fix for files over 100K – Nicer to do mathematically/analytically • Lots of red green colour noise – How much can this be reduced without decreasing image sharpness • Would morphing make for a better video – Worth exploring maybe • Investigate better encoder – Better quality and smaller filesize
  • 14. Research ? • Possible research questions – Anything useful about • Erosion • Weather • Sunrise/sunset time detection – possible cf. HMNAO times • Contentions – Perhaps it’s all been done before – Should have done a literature review • Still useful and fun – Applied to a nice task – Lot’s of room for iterative improvement • Better scripts, version control • Interesting problems to fix (as mentioned in further directions)

Editor's Notes

  1. Joke about the NSA ?
  2. Talk through what the script is doing and why
  3. Discussion about the types of problems – can’t just rely on slides – perhaps voice over of a video needed to make this as a standalone tutorial