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

New options suggestion #563

Open
pigscanflyyy opened this issue Dec 17, 2024 · 1 comment
Open

New options suggestion #563

pigscanflyyy opened this issue Dec 17, 2024 · 1 comment

Comments

@pigscanflyyy
Copy link

  1. Streamlink have this option to pipe the stream to video players like mpv or vlc. Right now, the --live-pipe-mux defaults to using ffmpeg. It would be also nice to have only a pipe option. The program only creates pipes for the stream
--player-fifo
      Make the --player read the stream through a named pipe instead of the stdin pipe.
  1. Have an option to WriteMetaJsonOnly. Currently, the only way I know(correct me if I'm wrong) to get only the meta.json is from this command
./N_m3u8DL-RE --write-meta-json --skip-download https://example.com

This will present a selection which is not ideal if you want all the information or you can use with --auto-select but that will get only the meta.json for the selected stream.

if (option.WriteMetaJsonOnly)
{
    if (!string.IsNullOrEmpty(option.SaveDir))
        {
            var jsonPath = Path.Combine(option.SaveDir, "meta.json");
            Directory.CreateDirectory(option.SaveDir); // Create directory if it doesn't exist
            await File.WriteAllTextAsync(jsonPath, extractor.RawFiles["meta.json"], Encoding.UTF8);
            Logger.InfoMarkUp($"Meta JSON saved to: [deepskyblue1]{jsonPath.EscapeMarkup()}[/]");
        }
    return;
}
  1. Another issue with meta.json is I believe it gets all the information even for segments. My suggestion is to have an option to only get the stream information similar to ffprobe. Ideally, we only want the stream_id, codec, resolution, bitrate, etc:
Input #0, dash, from 'https://example.com':
  Duration: N/A, start: 13724305.200000, bitrate: 9582 kb/s
  Program 0 
  Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 416x234 [SAR 1:1 DAR 16:9], 195 kb/s, 30 fps, 30 tbr, 30 tbn (default)
      Metadata:
        variant_bitrate : 200000
        id              : 1
      Side data:
        unknown side data type 24 (102 bytes)
  Stream #0:1: Video: h264 (avc1 / 0x31637661), none, 480x270, 403 kb/s, 30 tbr, 30 tbn (default)
      Metadata:
        variant_bitrate : 400000
        id              : 2
      Side data:
        unknown side data type 24 (102 bytes)
  Stream #0:2: Video: h264 (avc1 / 0x31637661), none, 640x360, 821 kb/s, 30 tbr, 30 tbn (default)
      Metadata:
        variant_bitrate : 800000
        id              : 3
      Side data:
        unknown side data type 24 (102 bytes)
  Stream #0:3: Video: h264 (avc1 / 0x31637661), none, 768x432, 1229 kb/s, 30 tbr, 30 tbn (default)
      Metadata:
        variant_bitrate : 1200000
        id              : 4
      Side data:
        unknown side data type 24 (102 bytes)
  Stream #0:4: Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2365 kb/s, 30 tbr, 30 tbn (default)
      Metadata:
        variant_bitrate : 2400000
        id              : 5
      Side data:
        unknown side data type 24 (102 bytes)
  Stream #0:5: Video: h264 (avc1 / 0x31637661), none, 1920x1080, 4505 kb/s, 30 tbr, 30 tbn (default)
      Metadata:
        variant_bitrate : 4499968
        id              : 6
      Side data:
        unknown side data type 24 (102 bytes)
  Stream #0:6(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 61 kb/s (default)
      Metadata:
        variant_bitrate : 63945
        id              : 7
      Side data:
        unknown side data type 24 (102 bytes)

That is all. Thank you for work!

@pigscanflyyy
Copy link
Author

Sample code that work for me but I dont know if this is optimal:

string videoPipe;
if (OperatingSystem.IsWindows())
{
    videoPipe = $"pipe://\\\\.\\pipe\\{pipeNames[0]}";
}
else
{
    videoPipe = Path.Combine(pipeDir, pipeNames[0]);
}

// Add all subsequent pipes as audio tracks
for (int i = 1; i < pipeNames.Length; i++)
{
    string audioPipe;
    if (OperatingSystem.IsWindows())
    {
        audioPipe = $"pipe://\\\\.\\pipe\\{pipeNames[i]}";
    }
    else
    {
        audioPipe = Path.Combine(pipeDir, pipeNames[i]);
    }
    mpvCommand.Append($"--audio-file=\"{audioPipe}\" ");
}

mpvCommand.Append($"{videoPipe} ");
mpvCommand.Append("--keep-open=no --no-terminal ");
mpvCommand.Append("--force-window ");

Logger.WarnMarkUp($"[deepskyblue1]{mpvCommand.ToString().EscapeMarkup()}[/]");

mpvProcess.StartInfo = new ProcessStartInfo()
{
    WorkingDirectory = Environment.CurrentDirectory,
    FileName = binary,
    Arguments = mpvCommand.ToString(),
    CreateNoWindow = false,
    UseShellExecute = true
};
mpvProcess.Start();

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