How to remove 1 2 file in a directory?

Hi-tech electronic and computer equipment and Internet. Better use of electricity, help with the work and specifications, equipment selection. Presentations fixtures and plans. Waves and electromagnetic pollution.
izentrop
Econologue expert
Econologue expert
posts: 13698
Registration: 17/03/14, 23:42
Location: picardie
x 1516
Contact :

Re: How to remove 1 file on 2 in a directory?




by izentrop » 12/06/16, 00:04

0 x
User avatar
chatelot16
Econologue expert
Econologue expert
posts: 6960
Registration: 11/11/07, 17:33
Location: Angouleme
x 264

Re: How to remove 1 file on 2 in a directory?




by chatelot16 » 12/06/16, 10:09

each system has its own programming language, to make a small program that automates this kind of operation: .bat file in windows, and bash file in linux

but to avoid these special languages ​​I prefer to make a program in pyton: it is a simple language available as well with linux as windows or mac

a program to erase a file on 2 in a directory will not make more than 4 line by writing a loop that starts and ends with the number of files that you want: this simple program must be modified at each use to adapt to the numbers a wipe off
0 x
Christophe
Moderator
Moderator
posts: 79323
Registration: 10/02/03, 14:06
Location: Greenhouse planet
x 11043

Re: How to remove 1 file on 2 in a directory?




by Christophe » 25/06/16, 19:44

izentrop wrote:with FFMPEG on the command line (...).


I'm back...

With more than 40 000 images stored after 1 capture months at 1 image per minute, FFMPEG is the only possible solution (at least for free) to process the big time lapse and this in one pass :) except having to copy / paste dozens of videos ...

Indeed; Beyond 2000 images Windows Movier Maker is in the cabbage ... and it's worse for GoPro Studio!

In addition, the FFMPEG -filter option: v "setpts = X * PTS" makes it possible to keep only X frames out of 1 with X <1 (see https://trac.ffmpeg.org/wiki/How%20to%2 ... 0a%20video) ... and thus to realize what I wanted (to delete 1 image on 2 or more) without making DIY computer!

In other words, to framerate the constant output video:

If you want to accelerate the video by 2: X = 0.5 (we keep 0.5 frame on 1)
If you want to speed up the video by 10: X = 0.1
0 x
izentrop
Econologue expert
Econologue expert
posts: 13698
Registration: 17/03/14, 23:42
Location: picardie
x 1516
Contact :

Re: How to remove 1 file on 2 in a directory?




by izentrop » 26/06/16, 11:40

Under linux or windows?
Under Vista, the concatenation does not work% of img% 03d.png causes an error.
0 x
Christophe
Moderator
Moderator
posts: 79323
Registration: 10/02/03, 14:06
Location: Greenhouse planet
x 11043

Re: How to remove 1 file on 2 in a directory?




by Christophe » 26/06/16, 13:21

Windows ... the command% 05d.jpg works at home ... but you have to be in the right directory (not the case when you run the .bat from ffmpeg) and it's case-sensitive: .JPG it's not the same as .jpg ... in short it is linux like under windows ...

Well I managed to compile 1 month in less than 10 minutes which is correct ... I add a little soundtrack and some explanations and I upload.
0 x
izentrop
Econologue expert
Econologue expert
posts: 13698
Registration: 17/03/14, 23:42
Location: picardie
x 1516
Contact :

Re: How to remove 1 file on 2 in a directory?




by izentrop » 26/06/16, 20:45

It's good, I got there. The combination of Ctrl + V keys does not work in the command line, while "paste" from the right button menu, works ... Go figure.
In addition to the images, it was also necessary to add an icon "command prompt" in the directory of the program, with the path "start in" modified.
After, it becomes simple;)
It is not "command% 05d.jpg" but% 03d :)
0 x
Christophe
Moderator
Moderator
posts: 79323
Registration: 10/02/03, 14:06
Location: Greenhouse planet
x 11043

Re: How to remove 1 file on 2 in a directory?




by Christophe » 27/06/16, 01:44

Ah yes must be paste with right mouse button ... CRTL + V has never worked I believe under the windows terminal ...

Hey, do you also do time lapse?

It's% 05d if you have 5 digits in the image name (which was my case with 40 000 images numbered from 00001.jpg to more than 42000.jpg) ... it's% 03d if you have 3 digits so 999 images max ... 1000 if you start with 000.jpg ...

Here is the exact command I used to process 40k from TIME00001.jpg images to TIME42270jpg

ffmpeg -f image2 -start_number 00001 -i TIME% 05d.JPG -vcodec libx264 -b: v 3000k -s 1440 * 1080 timelapse.mp4

I then deleted 2 frames on 3 with this command:

ffmpeg -i timelapse.mp4 -filter: v "setpts = 0.33 * PTS" -b: v 3000k timelapse_3xspeed.mp4

It is possible to integrate -filter: v "setpts = 0.33 * PTS" in the 1st command to do everything in 1 pass ...

Otherwise, I spent more time converting the names of the images in the correct chronological order (my gopro was not incrementing on 5 digits but on 4 so here's the brothel: files that had the same name and a chronological order to reclassify) that to use ffmpeg, for the reclassification, I used ANT RENAMER while passing by the EXIF ​​infos :) It's a good little app
0 x
izentrop
Econologue expert
Econologue expert
posts: 13698
Registration: 17/03/14, 23:42
Location: picardie
x 1516
Contact :

Re: How to remove 1 file on 2 in a directory?




by izentrop » 27/06/16, 10:49

No, it was just a test to see.
Thanks for the explanation. 05 = number of digits and d = decimal, I suppose.
"-start_number 00001" was not essential it seems to me.
A * .bat file must be able to execute several successive commands.

A convenient and short command to make a slideshow at intervals of 5 seconds with images img001.jpg at img999.jpg

code: Select all

ffmpeg -y -framerate 1/5 -i img%03d.jpg -c:v libx264  out.mp4


Usually, I don't use FFMPEG directly but through the windows WINFF interface. Order lines can be saved as "presets". No need to bother with file paths, but don't forget about limitations in file names.

My * .MOV format camera videos are not recognized by my TV. This is MP4 with a proprietary format. A preset MP4 with only changing the audio without touching the video makes a batch of files compatible in the blink of an eye. I also have a preselection to turn them into WMV, for movie maker : Wink:
0 x
Christophe
Moderator
Moderator
posts: 79323
Registration: 10/02/03, 14:06
Location: Greenhouse planet
x 11043

Re: How to remove 1 file on 2 in a directory?




by Christophe » 28/06/16, 18:59

Here is a first throw of 1 months of kittens in time lapse: http://www.dailymotion.com/video/x4iqdd ... se_animals

1 day = 30 seconds
0 x
izentrop
Econologue expert
Econologue expert
posts: 13698
Registration: 17/03/14, 23:42
Location: picardie
x 1516
Contact :

Re: How to remove 1 file on 2 in a directory?




by izentrop » 29/06/16, 12:17

Technically successful. Image

The rendering is more spectacular with a plant.
We can not have everything : Wink:
0 x

 


  • Similar topics
    Replies
    views
    Last message

Back to "Electricity, electronics and computers: Hi-tech, Internet, DIY, lighting, materials, and new"

Who is online ?

Users browsing this forum : No registered users and 135 guests