News for hackers. Stuff that matters.
Re:Stupid Programmer Tricks and Star Wars GIFs by btbuildem on Tuesday October 29, 2013 @09:34AM (#6633899)
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..
Re:Stupid Programmer Tricks and Star Wars GIFs by sigil on Tuesday October 29, 2013 @01:51PM (#6636103)
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

Re:Stupid Programmer Tricks and Star Wars GIFs by goostavos on Tuesday October 29, 2013 @06:43PM (#6638037)
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!
Re:Stupid Programmer Tricks and Star Wars GIFs by sigil on Tuesday October 29, 2013 @07:26PM (#6638282)
Try this:

    ffmpeg -i frame%04d.png -vcodec mjpeg -sameq test.avi
Re:Stupid Programmer Tricks and Star Wars GIFs by unlikelymordant on Tuesday October 29, 2013 @08:28PM (#6638590)
If I wanted to strip the audio into a big wav or mp3 file, how would that be done?
Re:Stupid Programmer Tricks and Star Wars GIFs by djeikyb on Wednesday October 30, 2013 @01:16AM (#6639651)
Something like this probably works:

    ffmpeg -i myvideo.mkv -vn -acodec ogg myvid_sans_video.ogg
Re:Stupid Programmer Tricks and Star Wars GIFs by mtrimpe on Wednesday October 30, 2013 @03:00PM (#6642463)
Or even just

    ffmpeg -i myvideo.mkv myaudio.mp3
Re:Stupid Programmer Tricks and Star Wars GIFs by mtrimpe on Tuesday October 29, 2013 @12:17PM (#6635274)
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.

Re:Stupid Programmer Tricks and Star Wars GIFs by tene on Tuesday October 29, 2013 @04:55PM (#6637344)
> 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?

Re:Stupid Programmer Tricks and Star Wars GIFs by mtrimpe on Tuesday October 29, 2013 @06:01PM (#6637804)
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.

Re:Stupid Programmer Tricks and Star Wars GIFs by tene on Tuesday October 29, 2013 @06:27PM (#6637949)
Oh. That's totally reasonable. Cool, thanks.
Re:Stupid Programmer Tricks and Star Wars GIFs by lelandbatey on Tuesday October 29, 2013 @02:00PM (#6636184)
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/

Re:Stupid Programmer Tricks and Star Wars GIFs by sixothree on Tuesday October 29, 2013 @03:55PM (#6637020)
I have to ask. What the heck is that gif from?
Re:Stupid Programmer Tricks and Star Wars GIFs by lelandbatey on Friday November 01, 2013 @04:30PM (#6656206)
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...

Re:Stupid Programmer Tricks and Star Wars GIFs by chewxy on Tuesday October 29, 2013 @09:39AM (#6633935)
gstreamer too can be used. I prefer gstreamer as it really does embody the unix philosophy (in its own weird way though)
Re:Stupid Programmer Tricks and Star Wars GIFs by sejje on Tuesday October 29, 2013 @01:59PM (#6636174)
I'm unfamiliar with gstreamer. Can you elaborate on this weird way?
Re:Stupid Programmer Tricks and Star Wars GIFs by gosub on Wednesday October 30, 2013 @09:11AM (#6640422)
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.
Re:Stupid Programmer Tricks and Star Wars GIFs by oakwhiz on Tuesday October 29, 2013 @04:38PM (#6637265)
avconv seems to be more up-to-date than ffmpeg.