LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-25-2022, 01:05 AM   #1
gilesaj001
Member
 
Registered: Apr 2017
Location: Australia
Distribution: Ubuntu
Posts: 79

Rep: Reputation: 0
Jitty AVI after creation.


I have a web site at http://dingo-den.com and I download an image every minute and at the nd of the day I create a AVI video. When this video is played back almost every one has some distortion, usually at the bottom of the frame that is jittery.

I have looked at each image for yesterday and none are distorted so I assume that it is somewhere in the video creation.

I use this to create the video. I am not a programmer so I just google a lot and after a long time I found this to be the best method, ecept for the jitter. I have looked at the options for ffmpeg but I do not know anything about video creation so I am lost/
Code:
ffmpeg -i img-%d.jpg -an -qscale 1 -filter:v "setpts=2.0*PTS" -vcodec msmpeg4v2 webcam2-video-hi.avi
Any help would be appreciated.
 
Old 07-25-2022, 01:22 AM   #2
gilesaj001
Member
 
Registered: Apr 2017
Location: Australia
Distribution: Ubuntu
Posts: 79

Original Poster
Rep: Reputation: 0
I just had a look at the images from the latest video created today and the distortion is on the images before the video is created. Is there a way to fix these images after being downloaded.

This is the way I get the image from the source:

Code:
ffmpeg -i http://www.tpsgc-pwgsc.gc.ca/citeparlementaire-parliamentaryprecinct/newhillcam.jpg netcam.jpg

Last edited by gilesaj001; 07-25-2022 at 01:24 AM.
 
Old 07-26-2022, 10:21 AM   #3
SW64
Member
 
Registered: May 2014
Distribution: Slackware
Posts: 262

Rep: Reputation: 123Reputation: 123
Quote:
Originally Posted by gilesaj001 View Post
I just had a look at the images from the latest video created today and the distortion is on the images before the video is created. Is there a way to fix these images after being downloaded.

This is the way I get the image from the source:

Code:
ffmpeg -i http://www.tpsgc-pwgsc.gc.ca/citeparlementaire-parliamentaryprecinct/newhillcam.jpg netcam.jpg
wget would be better for that purpose, not ffmpeg. Without the '-c copy' option, ffmpeg will still convert the media while wget leaves its 'cargo' alone. How are you getting the images every minute? Your image-grabbing ffmpeg command overwrite the same image.

http://dingo-den.com/index.php?nav=timelapse If this is the result of your work posted here, then the distortion/jittery part are incomplete frames, either by you or by its server's capturing/sharing process. If that's not the correct video, please post an example video or one (or a few) of the frames where you see this distortion/jittery.
 
Old 07-26-2022, 12:46 PM   #4
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
Quote:
Is there a way to fix these images after being downloaded.
Code:
agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0"

url="http://www.tpsgc-pwgsc.gc.ca/citeparlementaire-parliamentaryprecinct/newhillcam.jpg"

curl -A "$agent" "$url" -o newhillcam.jpg

file newhillcam.jpg
newhillcam.jpg: JPEG image data, JFIF standard 1.02, resolution (DPI), density 0x0, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=1], baseline, precision 8, 1920x1080, components 3
I see what you mean. The lenz on the camera seems to be distorting the bottom part of the image a little. I don't know if there is anything that can be done for that.

This does not look too bad except for a few bad images..
https://www.youtube.com/watch?v=Rmww71ITJsA

Quote:
download an image every minute and..
That parts is easy
Code:
#!/usr/bin/bash

agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0"

url="http://www.tpsgc-pwgsc.gc.ca/citeparlementaire-parliamentaryprecinct/newhillcam.jpg"

num=1
while :; do
    curl -A "$agent" "$url" -o newhillcam"$num".jpg
    #wget -U "$agent" "$url" -O newhillcam"$num".jpg
    num=$((num + 1))
    sleep 60
done
Quote:
at the nd of the day I create a AVI video.
Does it have to be an avi? I would rather have a x264 mp4. Since the images are all the same size, and no sound, that is fairly easy.

Example:
Code:
ffmpeg -framerate 1/5 -pattern_type glob -i '*.jpg' -c:v libx264 -crf 18 -preset slow -r 24 -pix_fmt yuv420p out.mp4
Modify the output framerate, and image viewing time as you wish.
 
Old 07-26-2022, 03:14 PM   #5
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Here is a site that has lots of advice about how to create movies (slideshows) from still images.
https://www.bannerbear.com/blog/how-...s-with-ffmpeg/
 
Old 07-27-2022, 01:15 AM   #6
gilesaj001
Member
 
Registered: Apr 2017
Location: Australia
Distribution: Ubuntu
Posts: 79

Original Poster
Rep: Reputation: 0
Thanks for the replies. I think that my main problem of the image distortion at he bottom is not fixable. Unless there is some sort of test I can do after the image is downloaded then download the image again ???
 
Old 07-27-2022, 01:58 PM   #7
SW64
Member
 
Registered: May 2014
Distribution: Slackware
Posts: 262

Rep: Reputation: 123Reputation: 123
I don't see the distortion you speak of but I do see the artifacts in some of the frames. Unless you're talking about the wide angle lens distortion? Which is natural to my eyes (I've seen it so many time I'm used to it). Some programs (maybe Darktable?) can fix lens distortion but I've never tried that on thousands of images in batch mode.

If the artifacts were already in the downloaded images after the capture events, then no, nothing you can do. Unless you invent a time machine to go back in time to try again. However, maybe the owner of the webcam has an archive system in place and maybe you can contact them to see if they'll give you a copy.

When I do these webcam image grabs via bash scripts, I usually have the grab timer set to half of whatever the online webcam's update timer is set to. That'll give me two same images per webcam's image update. I then go back to review and select the best one of the pairs. It's more work but for me, it's worth the end result.

With this method, I've run into situations where I had only one good copy of the pair. Sometime I don't have either. It's usually because the script has run again on top of a previous image grab that is taking too long to complete and the script then clobbered that previous job. One minute update/grab cycle is actually too fast for the grab script sometime. Maybe there's a hiccup or a lag in the internet connection, maybe the grab script started in the middle of the server's image update, maybe the grab-image computer is suddenly 100% CPU from another program, etc, etc.

That is what I think has happened to your images.

What the script should do is off-load a grab job and let it complete its grab independently and still have the script be able to start off another grab job on the next one minute cycle to complete independently. I do not know bash scripting well enough to pull this off. Maybe someone here can offer an insight on this. I've strikethroughed this idea. It won't work if the server updated its image in the middle of a grab. There's nothing left of the previous image to grab anymore. The script need to complete in time.

Last edited by SW64; 07-27-2022 at 03:51 PM.
 
Old 07-27-2022, 08:14 PM   #8
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
I ran a cron job using wget to grab those images at one minute intervals and found about 30 or so out of 1600+ that were hosed.

I was able to see the damaged ones by using the ffmpeg command suggested by teckk and using a 2 second frame rate so each image was displayed for 2 seconds.

The only fix possible is to follow the suggestions above to grab 2 copies per update on the webcam then view them and drop the ones that are damaged plus one copy of each that is undamaged, or with a single copy to just drop the damaged images and not have an exact time ratio throughout the movie.
 
Old 07-27-2022, 10:04 PM   #9
gilesaj001
Member
 
Registered: Apr 2017
Location: Australia
Distribution: Ubuntu
Posts: 79

Original Poster
Rep: Reputation: 0
Ok thanks for the replies you have given me a lot to think about and explore.
 
  


Reply

Tags
ffmpeg, jitter



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ls -1 avi*.avi | sed s/"P"/" file P"/g > mylist.txt gilesaj001 Linux - General 4 01-06-2021 02:04 AM
How to take video of an AVI and the sound of another AVI, to make one divx film ? frenchn00b Linux - General 4 12-21-2008 08:48 AM
Gui that convert AVI to AVI DivX, with telling final avi target final size ? frenchn00b Linux - General 5 03-02-2008 05:37 AM
change uploaded files from filename.avi to filename.avi.html like www.rapidshare.de latheesan Linux - Newbie 3 06-16-2005 04:33 AM
Converting avi to mpg OR creating an SVCD from an avi MasterC Linux - Software 5 03-28-2003 05:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration