Skip to content

GUACAMOLE-1370: guacenc output to stdout.#687

Open
grintor wants to merge 1 commit into
apache:mainfrom
grintor:main
Open

GUACAMOLE-1370: guacenc output to stdout.#687
grintor wants to merge 1 commit into
apache:mainfrom
grintor:main

Conversation

@grintor

@grintor grintor commented Jul 6, 2026

Copy link
Copy Markdown

Added a -o option to guacenc allowing the output path to be specified explicitly. It defaults to FILE.m4v as before when unspecified for backwards compatibility. Specifying "-" as the output path streams the encoded video to stdout. Normal MP4 (which is what's being used for file output still) doesn't support streaming, so we use fragmented MP4 here when outputting to stdout. This paves the way to streaming that stdout to a video player or even the browser in real time as it's being encoded.

Added a -o option to guacenc allowing the output path to be specified explicitly.
It defaults to FILE.m4v as before when unspecified for backwards compatibility.
Specifying "-" as the output path streams the encoded video to stdout.
Comment thread src/guacenc/guacenc.c
Comment thread src/guacenc/video.c
Comment on lines +59 to +65
/* The container format cannot be guessed from a pipe URL and must be
* specified explicitly. The "ipod" container is used, matching the
* container that would be guessed from the ".m4v" extension of the output
* files normally produced */
bool is_pipe = (strncmp(path, "pipe:", 5) == 0);
const char* format_name = is_pipe ? "ipod" : NULL;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an appropriate assumption to make universally, or should this be configurable, as well? Are there situations where users may want to stream in a format different than iPod?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"ipod" was already an assumption being made universally before, just not explicitly. When writing to a file, the third argument to avformat_alloc_output_context2() is NULL so libavformat guesses the container from the extension of the output path. Since that was hardcoded to "FILE.m4v" it was always making the same guess based on ".m4v" -- 'ipod'. This is a pretty universally supported format, even in web browsers, so I think it's a good default. Maybe someone will want it to be configurable in the future, but we can just wait for that feature request.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it was assumed by virtue of the fact that all files were necessarily m4v files. Now we're giving folks an option on what to name the files, which implicitly allows them to also adjust the format - and we're giving them an option to pipe everything to stdout, but forcing them to use the ipod format when going to stdout.

I'm not going to block this PR from going through if you don't want to do this, it's just something that seems to be in the same spirit as the ability to send it to stdout, and change the filename.

[It's also worth noting that simply having the ability to send to stdout means that you could also pipe it back into ffmpeg and reformat it that way, but you may start to lose the fidelity of the video that way due to lossy encodings, etc.]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants