Support for Video Recording

The Uzebox now have a fully functional emulator! Download and discuss it here.
Post Reply
User avatar
filipe
Posts: 42
Joined: Thu Dec 17, 2009 10:37 pm
Location: Cambridge, UK

Support for Video Recording

Post by filipe »

Hi,

I started to implement the support to record videos natively in Uzem using ffmpeg. Unfortunately I had no time to keep going with the implementation for the next weeks, so I'm posting here a patch with what I have been doing in the case someone wants to give a try.

This is a video of Megatris recorded using Uzem:
[youtube]http://www.youtube.com/watch?v=KZ6VYWxXj8w[/youtube]

As you can see, the current code records just video with no audio support (the audio in the video is from youtube audio library). The implementation is far from be completed and the patch is a bit "dirty". I'm still learning ffmpeg and video formats. To add audio I expect some big changes in the patch.

The Makefile patched is for Linux, but if someone try to get involved using Windows, I hope that setup the ffmpeg dev package should be the minor of the problems :)

Hope you enjoy the partial work. Contributions are welcome. Actually I'm posting this work because it is stopped here for some time and I though someone would like to get involved.

Cheers,
Filipe Rinaldi
Attachments
patch_Uzem_Video_r165.diff.zip
Patch based on version r165
(5.87 KiB) Downloaded 525 times
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Support for Video Recording

Post by uze6666 »

Wow thanks, that's awesome! :mrgreen: My capture card died some months ago and I really wanted to make some video of the games. I won't have time either in the next weeks but I will indeed have a look at your code, ffmpeg is something I wanted to fiddle with for some time.

-Uze
User avatar
paul
Posts: 457
Joined: Sat May 02, 2009 8:41 am
Location: Brisbane, Australia

Re: Support for Video Recording

Post by paul »

Great stuff, filipe.

The only way I know how to build on Windows is to follow this guide here. Also, you will probably need to make the following changes to libavformat/os_support.h:

Code: Select all

#if defined(__MINGW32__) && !defined(__MINGW32CE__)
#  include <fcntl.h>
#  define lseek(f,p,w) _lseeki64((f), (p), (w))
#endif /* defined(__MINGW32__) && !defined(__MINGW32CE__) */

+++ #if !defined(ETIMEDOUT) && defined(WSAETIMEDOUT) 
+++ #define ETIMEDOUT WSAETIMEDOUT 
+++ #endif 

static inline int is_dos_path(const char *path)
{
#if HAVE_DOS_PATHS
    if (path[0] && path[1] == ':')
        return 1;
#endif
    return 0;
}
I can provide a build if needed. However, a static link pushes uzem out to 20MB.
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Support for Video Recording

Post by uze6666 »

However, a static link pushes uzem out to 20MB.
I always prefer to have a single executable so let's use a static link. When we'll be at 200MB I'll perhaps reconsider... :lol:

-Uze
User avatar
paul
Posts: 457
Joined: Sat May 02, 2009 8:41 am
Location: Brisbane, Australia

Re: Support for Video Recording

Post by paul »

Looks like it strips down to 5.25MB, so no big deal after all.
User avatar
filipe
Posts: 42
Joined: Thu Dec 17, 2009 10:37 pm
Location: Cambridge, UK

Re: Support for Video Recording

Post by filipe »

Hi Chaps,

It has been more than one year and once a while (you know those boring raining days) I try to revamp this patch.

The previous patch had only the video stream, this time I've added a proper muxer(container?) but audio is still not working properly.
There is an audio stream but I didn't find a format which accepts Uzebox's sample rate (15.7KHz) so we need to scale.

Please find attached the latest patch.
Patch was rebased on r184 and I've tested on Linux only.

I'm using the latest FFMPEG version:
configuration: --enable-shared --enable-pic --prefix=/usr/local/ffmpeg/
libavutil 51. 8. 0 / 51. 8. 0
libavcodec 53. 7. 0 / 53. 7. 0
libavformat 53. 3. 1 / 53. 3. 1
libavdevice 53. 1. 1 / 53. 1. 1
libavfilter 2. 15. 1 / 2. 15. 1
libswscale 0. 14. 1 / 0. 14. 1

If you are feeling brave to try it:
* Checkout Uzebox revision 184
* From the uzem directory: "patch < UzemVideo_r184.patch"
* Update Makefile with your FFMPEG installation if necessary ("PKG_CONFIG_PATH=/usr/local/ffmpeg/lib/pkgconfig/")
To run (you can try different formats by changing the filename, but try to use only avi):
./uzem -v <filename>.avi <rom.hex>

Cheers,
-Filipe
Attachments
UzemVideo_r184.patch.zip
UzemVideo v2
(8.21 KiB) Downloaded 532 times
User avatar
Harty123
Posts: 467
Joined: Wed Jan 12, 2011 9:30 pm
Location: PM, Germany
Contact:

Re: Support for Video Recording

Post by Harty123 »

Hi,

I'm looking for a compiled executable for Windows of this UZEM with video patch?!

-Harty
User avatar
paul
Posts: 457
Joined: Sat May 02, 2009 8:41 am
Location: Brisbane, Australia

Re: Support for Video Recording

Post by paul »

I'm looking for a compiled executable for Windows of this UZEM with video patch?!
I used to have this, but I don't any longer. I also have no recollection of my previous posts in this thread, but maybe if you follow the link in my long-forgotten post, then you can get it working... :?
User avatar
Harty123
Posts: 467
Joined: Wed Jan 12, 2011 9:30 pm
Location: PM, Germany
Contact:

Re: Support for Video Recording

Post by Harty123 »

Hi Paul,

thx for your reply. Meanwhile I found another solution - a free screen recorder software called CAMSTUDIO. This works very fine with the standard emulator:

http://camstudio.org/


Here are some results:





It's also possible to record the sound with this tools...

-Harty
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Support for Video Recording

Post by uze6666 »

Awesome find Hartmut! :mrgreen: I've added a reference to the tool in the emulator's wiki page.

-Uze
Post Reply