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

[Feature request] Support setting custom extension when using video-pipe #291

Open
Aciz opened this issue Jul 3, 2024 · 0 comments
Open

Comments

@Aciz
Copy link

Aciz commented Jul 3, 2024

When using video-pipe to pipe video/audio to ffmpeg, the extension is hardcoded to be mp4.

Quake3e/code/client/cl_main.c

Lines 3539 to 3562 in 14e33fb

pipe = ( Q_stricmp( Cmd_Argv( 0 ), "video-pipe" ) == 0 );
if ( pipe )
ext = "mp4";
else
ext = "avi";
if ( Cmd_Argc() == 2 )
{
// explicit filename
Com_sprintf( filename, sizeof( filename ), "videos/%s", Cmd_Argv( 1 ) );
// override video file extension
if ( pipe )
{
char *sep = strrchr( filename, '/' ); // last path separator
char *e = strrchr( filename, '.' );
if ( e && e > sep && *(e+1) != '\0' ) {
ext = e + 1;
*e = '\0';
}
}
}

However, ffmpeg allows overriding the auto-determined container with -f <containter> flag. Combining this with video-pipe produces a correct container as per the -f flag, but the extension is still forced to be mp4. It would be nice to introduce something like cl_aviPipeExtension or cl_aviPipeContainer to allow specifying the extension.

With cl_aviPipeFormat "-pix_fmt yuvj420p -c:v mjpeg -q:v 10 -c:a pcm_s16le -f mov", which results in a MJPEG encoded video + wav audio in a .mov container, the resulting file is still .mp4, but the actual container is still .mov, and just requires manual renaming.

~/.q3a/baseq3/videos ❱ cat movcontainer.mp4-log.txt
ffmpeg version n7.0.1 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14.1.1 (GCC) 20240522
  configuration: ...
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
[avi @ 0x5c121c1bdd00] Stream #0: not enough frames to estimate rate; consider increasing probesize
[aist#0:1/pcm_s16le @ 0x5c121c1d25c0] Guessed Channel Layout: stereo
Input #0, avi, from 'fd:':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, bgr24, 1920x1080, 25 fps, 25 tbr, 25 tbn
  Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, stereo, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mjpeg (native))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
[swscaler @ 0x7d7d80012e80] deprecated pixel format used, make sure you did set range correctly
Output #0, mov, to '/home/aciz/.q3a/baseq3/videos/movcontainer.mp4':
  Metadata:
    encoder         : Lavf61.1.100
  Stream #0:0: Video: mjpeg (jpeg / 0x6765706A), yuvj420p(pc, progressive), 1920x1080, q=2-31, 200 kb/s, 25 fps, 12800 tbn
      Metadata:
        encoder         : Lavc61.3.100 mjpeg
      Side data:
        cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: pcm_s16le (sowt / 0x74776F73), 22050 Hz, stereo, s16, 705 kb/s
      Metadata:
        encoder         : Lavc61.3.100 pcm_s16le
[out#0/mov @ 0x5c121c1d2740] video:32300KiB audio:1096KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.014744%
frame=  319 fps= 54 q=10.0 Lsize=   33401KiB time=00:00:12.72 bitrate=21510.8kbits/s speed=2.14x

Parsing cl_aviPipeFormat for the -f flag might be another option in place of a dedicated cvar, but I'm not sure how reliable that would be.

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

No branches or pull requests

1 participant