השתמש ממשק ה- API של GrabzIt Node.js להמיר סרטונים מקוונים into GIF מונפשות. עם זאת עליך לזכור שבכל אחת מהדוגמאות להלן ליצור GIF מונפש save or save_to שיטה חייבת להיקרא לאחר url_to_animation שִׁיטָה.
הפרמטר היחיד הנדרש הוא כתובת האתר של MP4, AVI או וידאו מקוון אחר להמרה into GIF אנימציה ל url_to_animation
שִׁיטָה.
client.url_to_animation("http://www.example.com/video.avi"); //Then call the save or save_to method
המרת וידיאו של Vimeo או YouTube ישירות ל- GIF מונפשים עם ממשק ה- API של Node.js של GrabzIt, פשוט ציין את כתובת האתר של הדף בו מופיע הסרטון Vimeo או YouTube והווידאו שהוא מכיל יומר into GIF מונפש. עם זאת מכיוון ששירות זה מסתמך על אתר של צד שלישי, לא ניתן להבטיח שהוא יעבוד עבור כל סרטון וידאו.
client.url_to_animation("https://www.youtube.com/watch?v=a1Y73sPHKxw"); //Then call the save or save_to method
אתה יכול להעביר מזהה מותאם אישית אל ה- url_to_animation שיטה כמוצג להלן, ערך זה מועבר חזרה למטפל GrabzIt Node.js שלך. לדוגמה, מזהה מותאם אישית זה יכול להיות מזהה בסיס נתונים, המאפשר לשייך GIF מונפש לרשומת מסד נתונים מסוימת.
var grabzit = require('grabzit'); var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret"); var options = {"customId":123456}; client.url_to_animation("https://www.youtube.com/watch?v=a1Y73sPHKxw", options); //Then call the save method client.save("http://www.example.com/handler", function (error, id){ if (error != null){ throw error; } });
צלם פריים בודד מווידיאו שאתה צריך להגדיר את משך הזמן ואת הפרמטרים למסגרות לשנייה להיות 1. לאחר מכן תוכל להשיג את המסגרת הדרושה שלך על ידי הגדרת פרמטר מיקום ההתחלה.
var grabzit = require('grabzit'); var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret"); var options = {"start":3, "duration":1, "framesPerSecond":1}; client.url_to_animation("http://www.example.com/video.avi", options); //Then call the save or save_to method client.save_to("result.gif", function (error, id){ //this callback is called once the capture is downloaded if (error != null){ throw error; } });