generate 20fps h264 based on 100 images

1.  Generate test sources:   image and its h264 file.

                - copy 1 images for 100 times.

                - generate 20fps yuv420p h264 file ( ffmpeg -framerate 20 -i "%d.png" -vcodec h264 -b:v 10485760 -pix_fmt yuv420p "yuv420p_20fps.h264" )

 

import shutil
source = "./1.png"
for i in range(2,100):
    target = "./" + str(i) + ".png"
    #print(target)
    shutil.copy(source,target)

  

 

import os
import shutil


dog_image = ['/data/split_twoclass/test/person/2008_000330.jpg', '/data/split_twoclass/test/person/2008_007902.jpg', '/data/split_twoclass/test/person/2009_000219.jpg',  '/data/split_twoclass/test/person/2010_003996.jpg']

for i in dog_image:
    print(i)
    for j in range(100):
        target = "./" + i.split(".")[0].split("/")[-1] + "_" + str(j) + ".jpg"
        print(target)
        shutil.copy(i,target)

  

posted on 2020-07-27 13:56  cdekelon  阅读(72)  评论(0)    收藏  举报

导航