mirror of
https://github.com/RekuNote/Hatenatools3.git
synced 2026-10-30 08:19:12 +00:00
Should now be able to export flipnotes with background music. Need to sort out adding sound effects and test with flipnotes where the music is shorter than the video
This commit is contained in:
1 parent
4c0c19f1d7
commit
17085f316b
2 files changed
+53
-4
No files matched your search
@@ -605,6 +605,8 @@ def WriteImage(image, outputPath):
|
||||
return True
|
||||
|
||||
def get_metadata(flipnote):
|
||||
epoch = time.mktime(time.struct_time([2000, 1, 1, 0, 0, 0, 5, 1, -1]))
|
||||
|
||||
meta = {
|
||||
u"Current filename":flipnote.CurrentFilename[:-3]+filetype,
|
||||
u"Original filename":flipnote.OriginalFilename[:-3]+filetype,
|
||||
@@ -759,8 +761,6 @@ if __name__ == '__main__':
|
||||
DumpSFXUsage(flipnote,sys.argv[3])
|
||||
print "Done!"
|
||||
elif sys.argv[1] == "-m":
|
||||
epoch = time.mktime(time.struct_time([2000, 1, 1, 0, 0, 0, 5, 1, -1]))
|
||||
|
||||
if not os.path.isfile(sys.argv[2]):
|
||||
print "Error!\nSpecified file doesn't exist!"
|
||||
sys.exit()
|
||||
@@ -825,15 +825,32 @@ if __name__ == '__main__':
|
||||
|
||||
# Make temp dir and dump the frames and sound here
|
||||
tempdir = tempfile.mkdtemp()
|
||||
os.mkdir(tempdir+"/sounds")
|
||||
print "Dumping the frames..."
|
||||
DumpFrames(flipnote,tempdir)
|
||||
print "Done!"
|
||||
print "Dumping the sounds..."
|
||||
DumpSoundFiles(flipnote,tempdir)
|
||||
DumpSoundFiles(flipnote,tempdir+"/sounds")
|
||||
print "Done!"
|
||||
print "Dumping SFX usage..."
|
||||
DumpSFXUsage(flipnote,tempdir)
|
||||
DumpSFXUsage(flipnote,tempdir+"/sounds")
|
||||
print "Done!"
|
||||
|
||||
# Now we need the metadata so we can look up the FPS
|
||||
SPEEDS = [None,0.5,1,2,4,6,12,20,30]
|
||||
print "Getting metadata..."
|
||||
metadata = get_metadata(flipnote)
|
||||
print "Done!"
|
||||
speed = int(metadata["Frame speed"])
|
||||
fps = SPEEDS[speed]
|
||||
print "Flipnote is speed {speed}, so {fps} FPS".format(speed=speed,fps=fps)
|
||||
|
||||
# Now to make the video in ffmpeg
|
||||
export_command = ["ffmpeg","-framerate",str(fps),"-start_number","1","-i","{path}/frame %03d.png".format(path=tempdir),"-i","{path}/sounds/BGM.wav".format(path=tempdir),"-c:v","libx264","-shortest",out_file]
|
||||
if not os.path.isfile(tempdir+"/sounds/BGM.wav"):
|
||||
export_command.pop(7)
|
||||
export_command.pop(8)
|
||||
subprocess.call(export_command)
|
||||
|
||||
else:
|
||||
print "Error!\nThere's no such mode."
|
||||
@@ -0,0 +1,32 @@
|
||||
# Flipnote Speeds #
|
||||
|
||||
This is some reference material taken from http://flipnote.wikia.com/wiki/Flipnote_Speed regarding flipnote speeds.
|
||||
|
||||
## Flipnote Studio 3D ##
|
||||
|
||||
|Speed|FPS|
|
||||
|:===:|:=:|
|
||||
|0 |0.2|
|
||||
|1 |0.5|
|
||||
|2 |1 |
|
||||
|3 |2 |
|
||||
|4 |4 |
|
||||
|5 |6 |
|
||||
|6 |8 |
|
||||
|7 |12 |
|
||||
|8 |20 |
|
||||
|9 |22 |
|
||||
|10 |29 |
|
||||
|
||||
## Flipnote Studio DSi ##
|
||||
|
||||
|Speed|FPS|
|
||||
|:===:|:=:|
|
||||
|1 |0.5|
|
||||
|2 |1 |
|
||||
|3 |2 |
|
||||
|4 |4 |
|
||||
|5 |6 |
|
||||
|6 |12 |
|
||||
|7 |20 |
|
||||
|8 |30 |
|
||||
Reference in new issue
Block a user
