Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] doc/examples/demux_decode: update ffplay command for audio and video output (PR #20252)
@ 2025-08-15 22:02 ldm0
  0 siblings, 0 replies; only message in thread
From: ldm0 @ 2025-08-15 22:02 UTC (permalink / raw)
  To: ffmpeg-devel

PR #20252 opened by ldm0
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20252
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20252.patch

Signed-off-by: ldm0 <liudingming@bytedance.com>


From 0bb2f5f724d75171a7b87529fc1b1034669924ea Mon Sep 17 00:00:00 2001
From: ldm0 <liudingming@bytedance.com>
Date: Sat, 16 Aug 2025 06:01:26 +0800
Subject: [PATCH] doc/examples/demux_decode: update ffplay command for audio
 and video output

Signed-off-by: ldm0 <liudingming@bytedance.com>
---
 doc/examples/demux_decode.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/doc/examples/demux_decode.c b/doc/examples/demux_decode.c
index 64f5547bc4..e1dd7fa5df 100644
--- a/doc/examples/demux_decode.c
+++ b/doc/examples/demux_decode.c
@@ -336,15 +336,16 @@ int main (int argc, char **argv)
 
     if (video_stream) {
         printf("Play the output video file with the command:\n"
-               "ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n",
+               "ffplay -f rawvideo -vf format=%s -video_size %dx%d %s\n",
                av_get_pix_fmt_name(pix_fmt), width, height,
                video_dst_filename);
     }
 
     if (audio_stream) {
         enum AVSampleFormat sfmt = audio_dec_ctx->sample_fmt;
-        int n_channels = audio_dec_ctx->ch_layout.nb_channels;
+        AVChannelLayout *ch_layout = &audio_dec_ctx->ch_layout;
         const char *fmt;
+        char buf[64];
 
         if (av_sample_fmt_is_planar(sfmt)) {
             const char *packed = av_get_sample_fmt_name(sfmt);
@@ -352,15 +353,18 @@ int main (int argc, char **argv)
                    "(%s). This example will output the first channel only.\n",
                    packed ? packed : "?");
             sfmt = av_get_packed_sample_fmt(sfmt);
-            n_channels = 1;
+            ch_layout = &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
         }
 
         if ((ret = get_format_from_sample_fmt(&fmt, sfmt)) < 0)
             goto end;
 
+        if ((ret = av_channel_layout_describe(ch_layout, buf, sizeof(buf))) < 0)
+            goto end;
+
         printf("Play the output audio file with the command:\n"
-               "ffplay -f %s -ac %d -ar %d %s\n",
-               fmt, n_channels, audio_dec_ctx->sample_rate,
+               "ffplay -f %s -ch_layout %s -ar %d %s\n",
+               fmt, buf, audio_dec_ctx->sample_rate,
                audio_dst_filename);
     }
 
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-15 22:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-15 22:02 [FFmpeg-devel] [PATCH] doc/examples/demux_decode: update ffplay command for audio and video output (PR #20252) ldm0

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git