diff --git a/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt b/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt index c886ac622..2f91e09b2 100644 --- a/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt +++ b/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt @@ -15,6 +15,7 @@ add_executable(obs-ffmpeg-mux ${obs-ffmpeg-mux_HEADERS}) target_link_libraries(obs-ffmpeg-mux + libobs ${FFMPEG_LIBRARIES}) set_target_properties(obs-ffmpeg-mux PROPERTIES FOLDER "plugins/obs-ffmpeg") diff --git a/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c b/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c index bf604efb5..77b4e45a3 100644 --- a/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c +++ b/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c @@ -26,6 +26,7 @@ #include #include "ffmpeg-mux.h" +#include #include #define ANSI_COLOR_RED "\x1b[0;91m" @@ -73,6 +74,8 @@ static inline void resize_buf_free(struct resize_buf *rb) struct main_params { char *file; + /* printable_file is file with any stream key information removed */ + struct dstr printable_file; int has_video; int tracks; char *vcodec; @@ -175,6 +178,8 @@ static void ffmpeg_mux_free(struct ffmpeg_mux *ffm) free(ffm->audio); } + dstr_free(&ffm->params.printable_file); + memset(ffm, 0, sizeof(*ffm)); } @@ -317,6 +322,8 @@ static bool init_params(int *argc, char ***argv, struct main_params *params, *p_audio = audio; + dstr_copy(¶ms->printable_file, params->file); + #ifdef DEBUG_FFMPEG av_log_set_callback(ffmpeg_log_callback); #endif @@ -559,7 +566,8 @@ static inline int open_output_file(struct ffmpeg_mux *ffm) AVIO_FLAG_WRITE); if (ret < 0) { fprintf(stderr, "Couldn't open '%s', %s\n", - ffm->params.file, av_err2str(ret)); + ffm->params.printable_file.array, + av_err2str(ret)); return FFM_ERROR; } } @@ -586,8 +594,8 @@ static inline int open_output_file(struct ffmpeg_mux *ffm) ret = avformat_write_header(ffm->output, &dict); if (ret < 0) { - fprintf(stderr, "Error opening '%s': %s\n", ffm->params.file, - av_err2str(ret)); + fprintf(stderr, "Error opening '%s': %s", + ffm->params.printable_file.array, av_err2str(ret)); av_dict_free(&dict); @@ -622,7 +630,7 @@ static int ffmpeg_mux_init_context(struct ffmpeg_mux *ffm) if (output_format == NULL) { fprintf(stderr, "Couldn't find an appropriate muxer for '%s'\n", - ffm->params.file); + ffm->params.printable_file.array); return FFM_ERROR; } diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-mux.c b/plugins/obs-ffmpeg/obs-ffmpeg-mux.c index d946d57df..d5d45782f 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-mux.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-mux.c @@ -70,6 +70,7 @@ static void ffmpeg_mux_destroy(void *data) os_process_pipe_destroy(stream->pipe); dstr_free(&stream->path); + dstr_free(&stream->printable_path); bfree(stream); } @@ -354,7 +355,10 @@ int deactivate(struct ffmpeg_muxer *stream, int code) os_atomic_set_bool(&stream->active, false); os_atomic_set_bool(&stream->sent_headers, false); - info("Output of file '%s' stopped", stream->path.array); + info("Output of file '%s' stopped", + dstr_is_empty(&stream->printable_path) + ? stream->path.array + : stream->printable_path.array); } if (code) { diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-mux.h b/plugins/obs-ffmpeg/obs-ffmpeg-mux.h index b82b1fd74..92a2a9640 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-mux.h +++ b/plugins/obs-ffmpeg/obs-ffmpeg-mux.h @@ -20,6 +20,7 @@ struct ffmpeg_muxer { volatile bool capturing; volatile bool stopping; struct dstr path; + struct dstr printable_path; /* replay buffer */ int64_t cur_size;