Quake3e icon indicating copy to clipboard operation
Quake3e copied to clipboard

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

Open Aciz opened this issue 1 year ago • 0 comments

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

https://github.com/ec-/Quake3e/blob/14e33fbe196a10f272b35a1fda584ff1edd74a9a/code/client/cl_main.c#L3539-L3562

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.

Aciz avatar Jul 03 '24 14:07 Aciz