Hacker News new | past | comments | ask | show | jobs | submit login

I would suggest ffmpeg as an alternative -- it peels, it slices and it dices. It will definitely convert a range of a video file to gif while adding subtitles, and you won't have to frankenstein things together..



Totally agree, although the author's use of vlc definitely qualifies as a clever hack.

I want more hackers to realize how insanely easy it is to programmatically generate video with ffmpeg. Just write a program that dumps raw RGB frames to stdout! You can turn that into any video format conceivable, including gif.

Here's a little demo I wrote. Generates a video of the Mandelbrot set coming into focus:

https://github.com/acg/generating-video-demo

Example gif:

http://imgur.com/RiqEHJJ


Interesting! At work I hacked together a video writer that compiles still frames to a movie using OpenCV. But it is slow --ungodly slow. I'll have to check out ffmpeg!


Try this:

    ffmpeg -i frame%04d.png -vcodec mjpeg -sameq test.avi


If I wanted to strip the audio into a big wav or mp3 file, how would that be done?


Something like this probably works:

    ffmpeg -i myvideo.mkv -vn -acodec ogg myvid_sans_video.ogg


Or even just

    ffmpeg -i myvideo.mkv myaudio.mp3


There's even this (awesome) guide on optimizing video to gif conversion with ffmpeg and ImageMagick: http://blog.room208.org/post/48793543478

The file size reduction was quite impressive for our use case (roughly 10x smaller.)

In the end we did decide that while putting 5 second video intros in emails is cool, a 200k image is still a bit much for mobile users.


> putting 5 second video intros in emails is cool

You must have a very different experience of email than I do. That sounds absolutely terrible to me. Am I missing some reason that this would be useful, or is this just a case of wildly diverging preferences?


I meant 'cool' more as in 'hack-value'.

Our product (Interactly) is virtual video interactions, so our main value prop is being able to see real people respond.

In that context we figured it would be interesting to see if we could include a 5 second GIF intro right into the notification email; mostly out of curiosity just to see if it would technically be possible.

I was surprised to find out it was mostly feasible, but you're right that it doesn't make sense beyond the fact that it would be a cool gimmick.


Oh. That's totally reasonable. Cool, thanks.


Indeed, I have to vouch for ffmpeg as a the best solution. When I built GifMachine[0], it's pretty much just a web interface and automation layer to ffmpeg/imagemagick. Imagemagic and ffmpeg I found to be easy to use, fast, and delightfully scriptable. Using them together also produces the prettiest results.

For example, here's a gif produced with just ffmpeg: http://i.imgur.com/DWc4OdD.gif

And here is the version produced by ImageMagick: http://i.imgur.com/OdojPSo.gif

While the one made using ImageMagick looks better, it's also less compressed and takes up more space. So it's a tradeoff between the two.

[0] http://gifmachine.xwl.me/


I have to ask. What the heck is that gif from?


It's rather late to be posting this, but the gif is from this music video:

Duke Dumont - Need U @ 1:42

http://www.youtube.com/watch?feature=player_detailpage&v=FnJ...


gstreamer too can be used. I prefer gstreamer as it really does embody the unix philosophy (in its own weird way though)


I'm unfamiliar with gstreamer. Can you elaborate on this weird way?


The arguments to the gstreamer binary are encoders,decoders,filters and i/o piped together like commands in a shell (with the ! operator). For example, this is a shell command to show a h264 network stream on a raspberry pi:

    gst-launch-1.0 rtspsrc location=rtsp://192.168.2.112:8080/stream.sdp ! rtph264depay ! h264parse ! omxh264dec ! autovideosink
Gstreamer is more than this, but it'is a neat example.


avconv seems to be more up-to-date than ffmpeg.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: