Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: ldm0 <code@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] doc/examples/demux_decode: update ffplay command for audio and video output (PR #20252)
Date: Sat, 16 Aug 2025 01:02:38 +0300 (EEST)
Message-ID: <20250815220238.799B468D30E@ffbox0-bg.ffmpeg.org> (raw)

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".

                 reply	other threads:[~2025-08-15 22:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250815220238.799B468D30E@ffbox0-bg.ffmpeg.org \
    --to=code@ffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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