File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 11import logging
22
3- from PIL import Image , ImageFont , ImageDraw
3+ from PIL import Image , ImageDraw , ImageFont
44
5- logging .basicConfig ()
6-
7- import av
85from av .codec import CodecContext
96from av .video import VideoFrame
10-
117from tests .common import fate_suite
128
139
10+ logging .basicConfig ()
11+
12+
1413cc = CodecContext .create ('flv' , 'w' )
1514print (cc )
1615
1716base_img = Image .open (fate_suite ('png1/lena-rgb24.png' ))
1817font = ImageFont .truetype ("/System/Library/Fonts/Menlo.ttc" , 15 )
1918
2019
21-
22- fh = open ('test.flv' , 'w' )
20+ fh = open ('test.flv' , 'wb' )
2321
2422for i in range (30 ):
2523
3533 packet = cc .encode (frame )
3634 print (' ' , packet )
3735
38- fh .write (str ( buffer ( packet ) ))
36+ fh .write (bytes ( packet ))
3937
4038print ('Flushing...' )
4139
4442 if not packet :
4543 break
4644 print (' ' , packet )
47- fh .write (str ( buffer ( packet ) ))
45+ fh .write (bytes ( packet ))
4846
4947print ('Done!' )
You can’t perform that action at this time.
0 commit comments