0

for example. after write the video

 out = cv2.VideoWriter('video.avi', fourcc, fps, (int(width), int(height))) 

it saves a file with the name "video", I wanted that the next time I run it save the next video as video1 etc ...

  • 1
    `n=0`... `f"video{n}.avi"`... `n+=1`... – Pedro Lobito Mar 28 '20 at 22:41
  • eu queria isso, mas mudando numa string... neste caso video0, o video seguinte seria video1 etc nao percebi o que escreveste desculpa xd – FRango SStYle Mar 28 '20 at 22:43
  • Despite speaking Portuguese, the official language on SO is English, so lets keep our interactions in English. Otherwise use https://pt.stackoverflow.com/ – Pedro Lobito Mar 28 '20 at 22:44
  • Does this answer your question? [How can I concatenate str and int objects?](https://stackoverflow.com/questions/25675943/how-can-i-concatenate-str-and-int-objects) ... also: [How can I concatenate a string and a number in Python?](https://stackoverflow.com/questions/6981495/how-can-i-concatenate-a-string-and-a-number-in-python) – wwii Mar 28 '20 at 22:44
  • I wanted this, but changing it in a string ... in this case video0, the next video would be video1 etc. I didn't understand what you wrote sorry xd – FRango SStYle Mar 28 '20 at 22:45
  • Do you have a loop on your code or you're talking about the next time you run the script? – Pedro Lobito Mar 28 '20 at 22:46
  • hmm not really wwii – FRango SStYle Mar 28 '20 at 22:46
  • I have a loop, but every time I run the script I want it to keep the name of the video incrementing 1 – FRango SStYle Mar 28 '20 at 22:47
  • ... [Creating a new file, filename contains loop variable, python](https://stackoverflow.com/questions/12560600/creating-a-new-file-filename-contains-loop-variable-python) – wwii Mar 28 '20 at 22:51
  • i'm gonna check – FRango SStYle Mar 28 '20 at 22:52
  • If you've a loop, add it your question. – Pedro Lobito Mar 28 '20 at 23:04
  • i dont have a loop for that, just want a funtion that increment 1 the filename, every time run the script – FRango SStYle Mar 28 '20 at 23:06
  • "***I have a loop, but every time I run the script I want it to keep the name of the video incrementing 1***" then, couple of minutes after "***i don't have a loop for that, just want a function that increment 1 the filename, every time run the script***" , you're wasting everyone's time, including yours. – Pedro Lobito Mar 28 '20 at 23:11

0 Answers0