웹 캡처 및 변환 도구

Ruby를 사용하여 온라인 비디오를 애니메이션 GIF로 변환

루비 API

이 일반적인 팁을 사용하여 온라인 비디오를 애니메이션 GIF로 변환하십시오. GrabzIt는 루비 API입니다. 그러나 시작하기 전에 url_to_animation 방법 save or save_to 비디오를 캡처하려면 메소드를 호출해야합니다.

기본 옵션

필요한 유일한 매개 변수는 변환 할 MP4, AVI 또는 기타 온라인 비디오의 URL입니다. into 애니메이션 GIF.

grabzItClient.url_to_animation("http://www.example.com/video.avi")
# Then call the save or save_to method

Vimeo 또는 YouTube 비디오를 애니메이션 GIF로 변환

GrabzIt의 Ruby API는 Vimeo 또는 YouTube 비디오를 애니메이션 GIF로 직접 변환 할 수 있습니다. Vimeo 또는 YouTube 비디오가 표시되는 페이지의 URL을 지정하면 해당 비디오가 변환됩니다. into 애니메이션 GIF. 그러나이 서비스는 타사 웹 사이트를 사용하므로 모든 비디오에서 작동한다고 보장 할 수는 없습니다.

grabzItClient.url_to_animation("https://www.youtube.com/watch?v=a1Y73sPHKxw")
# Then call the save or save_to method

맞춤식 식별자

맞춤 식별자를 전달할 수 있습니다 into setCustomId 방법 AnimationOptions 아래 표시된대로이 값은 GrabzIt Ruby 핸들러로 리턴됩니다. 예를 들어이 사용자 지정 식별자는 데이터베이스 식별자 일 수 있으며 애니메이션 GIF를 특정 데이터베이스 레코드와 연결할 수 있습니다.

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::AnimationOptions.new()
options.customId = "123456"

grabzItClient.url_to_animation("https://www.youtube.com/watch?v=a1Y73sPHKxw", options)
# Then call the save method
grabzItClient.save("http://www.example.com/handler/index")

비디오에서 단일 프레임 캡처

비디오에서 단일 프레임을 캡처하려면 기간과 초당 프레임 매개 변수를 1로 설정해야합니다. 그런 다음 시작 위치 매개 변수를 설정하여 필요한 프레임을 얻을 수 있습니다.

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::AnimationOptions.new()
options.framesPerSecond = 1
options.duration = 1
options.start = 3

grabzItClient.url_to_animation("http://www.example.com/video.avi", options)
# Then call the save or save_to method
grabzItClient.save_to("result.gif")