Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More flexible conversion script #2

Merged
merged 4 commits into from Jan 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Empty file modified .gitignore 100644 → 100755
Empty file.
Empty file modified LICENSE 100644 → 100755
Empty file.
Empty file modified Makefile 100644 → 100755
Empty file.
Empty file modified README.md 100644 → 100755
Empty file.
Empty file modified TODO 100644 → 100755
Empty file.
47 changes: 45 additions & 2 deletions convert-to-avi.sh
@@ -1,4 +1,47 @@
#!/bin/sh

./filter --audio "$1" | lame - audio.mp3
./filter --video "$1" | mencoder -vf scale=1280:720 -ovc xvid -xvidencopts bitrate=1800 -oac copy -audiofile audio.mp3 -o video.avi -
#setup default values
audioname="audio.mp3"
videoname="video.avi"
scriptpath=

#retrieve values.
while getopts a:v:s: name
do
echo "$OPTARG"
case $name in
a) audioname="$OPTARG";;
v) videoname="$OPTARG";;
s) scriptpath="$OPTARG";;
?) printf "Usage: %s: [-a audiofile] [-v videofile] [-s scriptpath] rawfile.seom\n" $0
exit 2;;
esac
done

#retrieving raw file (rawfile.seom) and the encode script path [encodescript]
shift $(($OPTIND - 1))
echo "$*"
rawfile="$1"

#if no raw is given, ask for one.
if [ ! -n $rawfile ]; then
echo "you did not give a raw file (rawfile.seom)."
printf "Usage: %s: [-a audiofile] [-b videofile] [-s scriptpath] rawfile.seom\n" $0
exit 2
fi

#extract audio with lame
echo "generating .mp3 audio file from $rawfile ..."
./filter --audio "$rawfile" | lame - "$audioname"
echo "generated! you can find it at $audioname"

#encode the video.
echo "encoding video from $rawfile ..."
if [ -z $scriptpath ]; then
echo "scriptpath is empty"
./filter --video "$rawfile" | mencoder -vf scale=1280:720 -ovc xvid -xvidencopts bitrate=1800 -oac copy -audiofile $audioname -o $videoname -
else
echo "scriptpath is not empty"
./filter --video "$rawfile" | ./"$scriptpath" "$audioname" "$videoname"
fi
echo "generated! you can find it at $videoname"
1 change: 1 addition & 0 deletions encode_scripts/example.sh
@@ -0,0 +1 @@
mencoder -vf scale=960:768 -ovc xvid -xvidencopts bitrate=1800 -oac copy -audiofile "$1" -o "$2" -
Empty file modified include/loader.h 100644 → 100755
Empty file.
Empty file modified include/stream.h 100644 → 100755
Empty file.
Empty file modified include/yukon.h 100644 → 100755
Empty file.
Empty file modified src/core/audio.c 100644 → 100755
Empty file.
Empty file modified src/core/conf.c 100644 → 100755
Empty file.
12 changes: 9 additions & 3 deletions src/core/engine.c 100644 → 100755
Expand Up @@ -6,12 +6,14 @@ static uint64_t targetInterval;
struct yukonEngine *yukonEngineCreate(const char *spec, unsigned long scale, unsigned long size[2])
{
struct yukonEngine *engine = malloc(sizeof(struct yukonEngine));
if (engine == NULL)
if (engine == NULL){
logMessage(4, "[yukonEngineCreate] Couldn't create engine, probably you don't have enough memory\n");
return NULL;
}

engine->stream = yukonStreamCreate(spec, 16);
if (engine->stream == NULL) {
logMessage(4, "Failed to open output stream\n");
logMessage(4, "[yukonEngineCreate] Failed to open output stream\n");
free(engine);
return NULL;
}
Expand Down Expand Up @@ -62,11 +64,15 @@ void yukonEngineCapture(struct yukonEngine *engine)
lastCapture = now;

struct seomPacket *packet = seomPacketCreate(0x01, engine->size[0] * engine->size[1] * 4);
if (packet == NULL)
if (packet == NULL){
logMessage(4, "[yukonEngineCapture] seomPacketCreate failed\n");
return;
}

glReadPixels(0, 0, engine->size[0], engine->size[1], GL_BGRA, GL_UNSIGNED_BYTE, seomPacketPayload(packet));
logMessage(4, "[yukonEngineCapture] glReadPixels succeded\n");
yukonStreamPut(engine->stream, packet);
logMessage(4, "[yukonEngineCapture] put packed into stream correctly!\n");
}

struct yukonEngine *yukonEngineDestroy(struct yukonEngine *engine)
Expand Down
Empty file modified src/core/log.c 100644 → 100755
Empty file.
Empty file modified src/core/opengl.c 100644 → 100755
Empty file.
Empty file modified src/filter/main.c 100644 → 100755
Empty file.
Empty file modified src/filter/wav.c 100644 → 100755
Empty file.
Empty file modified src/filter/y4m.c 100644 → 100755
Empty file.
8 changes: 5 additions & 3 deletions src/glue/glue.c 100644 → 100755
Expand Up @@ -18,8 +18,11 @@ void glueEvent(Display *dpy, XEvent *event)

lastEvent = event->xkey.time;
hotkeyPressed = !engine;
if (engine)
logMessage(4, "hotkeyPressed: %i\n", hotkeyPressed);
if (engine){
engine = yukonEngineDestroy(engine);
logMessage(4, "Destroyed engine\n");
}
}
break;
default:
Expand All @@ -29,7 +32,7 @@ void glueEvent(Display *dpy, XEvent *event)

void glueDrawable(Display *dpy, GLXDrawable drawable)
{
if (hotkeyPressed && engine == NULL) {
if (hotkeyPressed && engine == NULL) {
hotkeyPressed = 0;

/* reload configuration in case it changed */
Expand All @@ -43,7 +46,6 @@ void glueDrawable(Display *dpy, GLXDrawable drawable)

/* create the main engine */
engine = yukonEngineCreate(yukonGlobal.output, yukonGlobal.scale, size);

if (engine) {
logMessage(4, "Yukon engine is active now\n");
} else {
Expand Down
Empty file modified src/libs/libGL.c 100644 → 100755
Empty file.
Empty file modified src/libs/libX11.c 100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion src/scripts/yukon
Expand Up @@ -25,4 +25,5 @@ for DIR in ${SYSDIRS}; do
fi
done

LD_LIBRARY_PATH="${YLDPATH}:${LD_LIBRARY_PATH}" YUKON="${PROFILE}" "${@}"
echo "${YLDPATH}:${LD_LIBRARY_PATH}" YUKON="${PROFILE}"
LD_LIBRARY_PATH="${YLDPATH}:${LD_LIBRARY_PATH}" YUKON="${PROFILE}" "${@}"
Empty file modified src/stream/arch/C/frame.c 100644 → 100755
Empty file.
Empty file modified src/stream/arch/amd64/frame.asm 100644 → 100755
Empty file.
Empty file modified src/stream/arch/x86/frame.asm 100644 → 100755
Empty file.
Empty file modified src/stream/buffer.c 100644 → 100755
Empty file.
14 changes: 10 additions & 4 deletions src/stream/stream.c 100644 → 100755
Expand Up @@ -35,7 +35,7 @@ static void *streamMultiplexerThread(void *data)
struct seomPacket *packet = yukonBufferGet(stream->buffer);
if (packet == NULL)
break;

switch (packet->type) {
case 0x00:
memcpy(&header, seomPacketPayload(packet), sizeof(header));
Expand Down Expand Up @@ -76,11 +76,14 @@ static struct seomStreamOps ops = { put, get };
struct yukonStream *yukonStreamCreate(const char *spec, unsigned long size)
{
struct yukonStream *stream = malloc(sizeof(struct yukonStream));
if (stream == NULL)
return NULL;
if (stream == NULL){
printf("[yukonStreamCreate] couldn't create stream\n");
return NULL;
}

stream->fileDescriptor = -1;
if (strncmp(spec, "file://", 7) == 0) {
printf("[yukonStreamCreate] is a file://!, %s", &spec[7]);
stream->fileDescriptor = open(&spec[7], O_WRONLY | O_CREAT | O_TRUNC, 0664);
} else if (strncmp(spec, "ipv4://", 7) == 0) {
struct sockaddr_in addr = {
Expand All @@ -96,20 +99,23 @@ struct yukonStream *yukonStreamCreate(const char *spec, unsigned long size)
stream->fileDescriptor = -1;
}
}

if (stream->fileDescriptor < 0) {
printf("[yukonStreamCreate] fileDescriptor is less than zero, couldn't create file!\n");
free(stream);
return NULL;
}

stream->stream = seomStreamCreate(&ops, stream);
if (stream->stream == NULL) {
printf("[yukonStreamCreate] couldn't create stream\n");
free(stream);
return NULL;
}

stream->buffer = yukonBufferCreate(size);
if (stream->buffer == NULL) {
printf("[yukonStreamCreate] couldn't create buffer\n");
free(stream);
return NULL;
}
Expand Down
Empty file modified src/tools/stat.c 100644 → 100755
Empty file.
7 changes: 6 additions & 1 deletion tools/yukon.conf 100644 → 100755
Expand Up @@ -11,14 +11,19 @@
# file://
# Specifies a single file which will be used and subsequently
# rewritten.
# Please note that, if OUTPUT starts with file:// and ends with a slash
# (/), a file named "[exe]-[date]-[time].seom" will be generated in the
# specified path.
# This behaviour is useful if you plan to make more recording sessions
# in the same day.
# ipv4://
# Specifies an IP address where seom-server is running. Please note
# there is currently no way to change (or specify) the port number;
# seom-server
# OUTPUT = file:///tmp/yukon.seom

# The "Frames Per Second" of Yukon. This isn't a guarantee, but Yukon/Seom
# tries it's best to honor your request here. I recommend setting this to
# tries its best to honor your request here. I recommend setting this to
# your vsync rate, and forcing your app to refresh accordingly.
# FPS = 30.0

Expand Down