#390(FFplay:new): ffplay cannot select desired audio/video stream, consider there is a bug in the av_read_frame function
#390: ffplay cannot select desired audio/video stream, consider there is a bug in the av_read_frame function ------------------------+--------------------- Reporter: qrtt1 | Owner: michael Type: defect | Status: new Priority: important | Component: FFplay Version: git | Keywords: Blocked By: | Blocking: Reproduced: 0 | Analyzed: 0 ------------------------+--------------------- There is a mms stream which contains five video/audio streams. {{{ qty:ffmpeg_bug qrtt1$ ./ffprobe mmsh://media.uvcm.eu/maya4ok ffprobe version N-31809-g9acffed, Copyright (c) 2007-2011 the FFmpeg developers built on Aug 11 2011 03:55:29 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3) configuration: --prefix=HERE libavutil 51. 11. 1 / 51. 11. 1 libavcodec 53. 10. 0 / 53. 10. 0 libavformat 53. 6. 0 / 53. 6. 0 libavdevice 53. 2. 0 / 53. 2. 0 libavfilter 2. 28. 1 / 2. 28. 1 libswscale 2. 0. 0 / 2. 0. 0 [asf @ 0x10104e600] max_analyze_duration 5000000 reached at 5120000 [asf @ 0x10104e600] Estimating duration from bitrate, this may be inaccurate Input #0, asf, from 'mmsh://media.uvcm.eu/maya4ok': Metadata: WM/ParentalRating: Uploaded by: www.evangelist-online.net Uploaded by : www.evangelist-online.net WMFSDKVersion : 10.00.00.4005 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 genre : Христианское ТВ "Библейский маяк" title : "1-й комплекс 4-й день" copyright : ТРК "3 Ангела" comment : "Вместе веселей" Duration: N/A, start: 14.120000, bitrate: 1730 kb/s Stream #0.0: Audio: wmav2, 48000 Hz, 2 channels, s16, 128 kb/s Stream #0.1: Audio: wmav2, 48000 Hz, 2 channels, s16, 96 kb/s Stream #0.2: Audio: wmav2, 44100 Hz, 2 channels, s16, 80 kb/s Stream #0.3: Audio: wmav2, 44100 Hz, 2 channels, s16, 31 kb/s Stream #0.4: Video: wmv3 (Main), yuv420p, 640x480, 864 kb/s, 1k tbr, 1k tbn, 1k tbc Stream #0.5: Video: wmv3 (Main), yuv420p, 384x288, 240 kb/s, 1k tbr, 1k tbn, 1k tbc Stream #0.6: Video: wmv3 (Main), yuv420p, 384x288, 158 kb/s, 1k tbr, 1k tbn, 1k tbc Stream #0.7: Video: wmv3 (Main), yuv420p, 384x288, 84 kb/s, 1k tbr, 1k tbn, 1k tbc Stream #0.8: Audio: wmav2, 8000 Hz, 2 channels, s16, 12 kb/s Stream #0.9: Video: wmv3 (Main), yuv420p, 192x144, 36 kb/s, 12.50 tbr, 1k tbn, 1k tbc }}} I can play it in the default settings, but can't play with the desired streams, both video and audio disappear. {{{ ./ffplay -ast 2 -vst 4 mmsh://media.uvcm.eu/maya4ok }}} I try to figure out what's wrong with it, and find the av_read_frame always read the stream index at 8 and 9. It can reproduce from git source revision 9acffed9e0d7c454b7bc5c947f33cdf8cab3758c (cloned today.) Just print which index the av_read_frame given. {{{ qty:ffmpeg_bug qrtt1$ git diff diff --git a/ffplay.c b/ffplay.c index b62e9ef..703eac2 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2495,6 +2495,8 @@ static int read_thread(void *arg) continue; } ret = av_read_frame(ic, pkt); + av_log(NULL, AV_LOG_WARNING, "stream index: %d\n", pkt->stream_index); + if (ret < 0) { if (ret == AVERROR_EOF || url_feof(ic->pb)) }}} -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/390> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#390: ffplay cannot select desired audio/video stream, consider there is a bug in the av_read_frame function ----------------------+---------------------- Reporter: qrtt1 | Owner: michael Type: defect | Status: new Priority: important | Component: FFplay Version: git | Resolution: Keywords: | Blocked By: Blocking: | Reproduced: 0 Analyzed: 0 | ----------------------+---------------------- Comment (by qrtt1): I compared with the request sent by mplayer (packet caught by wireshark). In stream selection header, it sent exactly two streams (video and audio): {{{ Pragma: stream-switch-entry=ffff:1:0 ffff:6:0 \r\n }}} However, libavformat/mmsh.c select all the streams, we always get the last two index 8 and 9. I test it by hardcode stream index in mmsh.c. The ffprobe can give the desired streams: {{{ [asf @ 0x10104e600] pkt idx 0 [PACKET] codec_type=audio stream_index=0 pts=175697 pts_time=175.697000 dts=175697 dts_time=175.697000 duration=170 duration_time=0.170000 size=2731.000000 pos=1581626 flags=K [/PACKET] [asf @ 0x10104e600] pkt idx 4 [PACKET] codec_type=video stream_index=4 pts=177720 pts_time=177.720000 dts=177720 dts_time=177.720000 duration=0 duration_time=0.000000 size=3000.000000 pos=1578738 flags=_ [/PACKET] }}} It is my test code {{{ qty:ffmpeg_bug qrtt1$ git diff diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c index 029baed..8b79616 100644 --- a/libavformat/mmsh.c +++ b/libavformat/mmsh.c @@ -268,10 +268,14 @@ static int mmsh_open(URLContext *h, const char *uri, int flags) return AVERROR(ENOMEM); for (i = 0; i < mms->stream_num; i++) { char tmp[20]; - err = snprintf(tmp, sizeof(tmp), "ffff:%d:0 ", mms->streams[i].id); - if (err < 0) - goto fail; - av_strlcat(stream_selection, tmp, mms->stream_num * 19 + 1); + if(i==0||i==4) + { + err = snprintf(tmp, sizeof(tmp), "ffff:%d:0 ", mms->streams[i].id); + if (err < 0) + goto fail; + av_strlcat(stream_selection, tmp, mms->stream_num * 19 + 1); + av_log(NULL, AV_LOG_ERROR, "stream select %d %d\n", i, mms->streams[i].id); + } } // send play request err = snprintf(headers, sizeof(headers), @@ -284,7 +288,9 @@ static int mmsh_open(URLContext *h, const char *uri, int flags) "Pragma: stream-switch-count=%d\r\n" "Pragma: stream-switch-entry=%s\r\n" "Connection: Close\r\n", - host, port, mmsh->request_seq++, mms->stream_num, stream_selection); + host, port, mmsh->request_seq++, 2 /*mms->stream_num */, stream_selection); + + av_log(NULL, AV_LOG_ERROR, "stream select header\n%s\n", headers); av_freep(&stream_selection); if (err < 0) { av_log(NULL, AV_LOG_ERROR, "Build play request failed!\n"); }}} {{{ }}} -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/390#comment:1> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#390: ffplay cannot select desired audio/video stream, consider there is a bug in the av_read_frame function -----------------------+----------------------- Reporter: qrtt1 | Owner: michael Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: mmsh | Blocked By: Blocking: | Reproduced: 1 Analyzed: 0 | -----------------------+----------------------- Changes (by cehoyos): * status: new => open * reproduced: 0 => 1 * component: FFplay => avformat * priority: important => normal * version: git => git-master * keywords: => mmsh Comment: This is certainly reproducible (and FFmpeg does not warn that audio/video stream selection is not possible for this mms stream). -- Ticket URL: <https://avcodec.org/trac/ffmpeg/ticket/390#comment:2> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#390: Audio/Video not selectable in mmsh stream -----------------------+----------------------- Reporter: qrtt1 | Owner: michael Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: mmsh | Blocked By: Blocking: | Reproduced: 1 Analyzed: 0 | -----------------------+----------------------- -- Ticket URL: <https://avcodec.org/trac/ffmpeg/ticket/390#comment:3> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#390: Audio/Video not selectable in mmsh stream ------------------------------------+------------------------------------ Reporter: qrtt1 | Owner: michael Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: mmsh | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by qrtt1): There is my work around for our software. https://github.com/qrtt1/ffmpeg_icy/commit/f735b761a0c22a7618bd5e398701187e7... However, it's not easy to use. We should open the mms first for getting stream index and choose the selected index by callback in next open stream url. It just work. -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/390#comment:4> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#390: Audio/Video not selectable in mmsh stream ------------------------------------+------------------------------------ Reporter: qrtt1 | Owner: michael Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: mmsh | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by cehoyos): Please do not use NULL as av_log() context and I suspect AV_LOG_DEBUG is sufficient, don't you agree? Please send your patch to ffmpeg-devel, it can be discussed there. -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/390#comment:5> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#390: Audio/Video not selectable in mmsh stream ------------------------------------+------------------------------------ Reporter: qrtt1 | Owner: michael Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: mmsh | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by michael): mmsh://media.uvcm.eu/maya4ok gives HTTP error 404 Not Found -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/390#comment:6> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#390: Audio/Video not selectable in mmsh stream ------------------------------------+------------------------------------ Reporter: qrtt1 | Owner: michael Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: mmsh | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by cehoyos): I find it much worse that the patch cannot be accessed anymore - instead FFmpeg binaries without source are distributed on https://github.com/qrtt1/ffmpeg_lab/tree/prebuilt/prebuilt -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/390#comment:7> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#390: Audio/Video not selectable in mmsh stream ------------------------------------+------------------------------------ Reporter: qrtt1 | Owner: michael Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: mmsh | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by qrtt1): Replying to [comment:7 cehoyos]:
I find it much worse that the patch cannot be accessed anymore - instead FFmpeg binaries without source are distributed on https://github.com/qrtt1/ffmpeg_lab/tree/prebuilt/prebuilt
The source of our repo ffmpeg_lab is the same with official ffmpeg n0.8.2, no any changes with it. This repo is used to write some tips for our team member [https://github.com/qrtt1/ffmpeg_lab/wiki/FFmpeg-Tool-Notes] Our patches lived in ffmpeg_icy repo: https://github.com/muzee-git/ffmpeg_icy (moved from my account qrtt1) Each extra branches made by me are public: [https://github.com/muzee-git/ffmpeg_icy/commits/m0.8.6.3] The new url for mms selection work around is at: * for 0.8.x [https://github.com/muzee- git/ffmpeg_icy/commit/9d0dc4b83a1752b66774fc66ad2cc0e348d732bb] * for 0.9.x [https://github.com/muzee- git/ffmpeg_icy/commit/cf65d9a2fbc10d0d742bdc5a86fd3c0d5ba74ef9] I am sorry to notify the owner transfered event. (qrtt1 to muzee) -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/390#comment:8> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#390: Audio/Video not selectable in mmsh stream ------------------------------------+------------------------------------ Reporter: qrtt1 | Owner: michael Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: mmsh | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by qrtt1): Add some multi-stream test case: * mms://74.54.73.194/webcasting_gunaz * mms://a1248.l6623941247.c66239.g.lm.akamaistream.net/D/1248/66239/v0001/reflector:41247 * mms://www.manworthy.tv:8088/play -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/390#comment:9> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#390: Audio/Video not selectable in mmsh stream ------------------------------------+------------------------------------ Reporter: qrtt1 | Owner: michael Type: defect | Status: closed Priority: normal | Component: avformat Version: git-master | Resolution: fixed Keywords: mmsh | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Changes (by michael): * status: open => closed * resolution: => fixed Comment: I tried ./ffplay -vst 7 mmsh://74.54.73.194/webcasting_gunaz and it plays stream 7 I tried ./ffplay -vst 5 mmsh://74.54.73.194/webcasting_gunaz and it plays stream 5 So id say this has been fixed, please reopen if you can still reproduce such a problem with ffmpeg git master -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/390#comment:10> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg