[FFmpeg-trac] #7955(undetermined:new): aselectstream hangs in multiple scenarios

FFmpeg trac at avcodec.org
Fri Jun 14 01:56:58 EEST 2019


#7955: aselectstream hangs in multiple scenarios
-------------------------------------+-------------------------------------
             Reporter:  ericball     |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 My objective is to use sendcmd/streamselect & asendcmd/astreamselect as
 part of a filter_comple_script processing multiple video+audio inputs into
 a single video_audio stream.  sendcmd/streamselect works fine, but
 astreamselect causes ffmpeg to hang unless the input files are pure audio
 files.

 Note: these are trivial examples which could be accomplished using map,
 but I wanted to avoid any unnecessary complexity (e.g. asendcmd).

 Reproduced using ffmpeg version N-94014-g80e68ce116-tessus on macOS
 10.14.5

 astreamselect20190613.mp4 (to be uploaded) contains three streams:
 {{{
 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
 1920x1080 [SAR 1:1 DAR 16:9], 12635 kb/s, 60 fps, 60 tbr, 15360 tbn, 120
 tbc (default)
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
 fltp, 127 kb/s (default)
 Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
 fltp, 128 kb/s (default)
 }}}

 Test 1, video+audio file input, hangs until Ctrl-C,
 ffmpeg-20190613-070608.log:
 {{{
 ./ffmpeg "-report:level=99" -i astreamselect20190613.mp4 -filter_complex:a
 "astreamselect=inputs=2:map=1" -c:v copy test1out.mp4

 Input file #0 (astreamselect20190613.mp4):
   Input stream #0:0 (video): 5 packets read (257819 bytes);
   Input stream #0:1 (audio): 3 packets read (797 bytes); 2 frames decoded
 (2048 samples);
   Input stream #0:2 (audio): 4 packets read (1325 bytes); 3 frames decoded
 (3072 samples);
   Total: 12 packets (259941 bytes) demuxed
 Output file #0 (test1out.mp4):
   Output stream #0:0 (audio): 2 frames encoded (2048 samples); 3 packets
 muxed (967 bytes);
   Output stream #0:1 (video): 5 packets muxed (257819 bytes);
   Total: 8 packets (258786 bytes) muxed
 5 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x7ffc4f40da00] Statistics: 2 seeks, 4 writeouts
 [aac @ 0x7ffc52000000] Qavg: 225.886
 [AVIOContext @ 0x7ffc4f4037c0] Statistics: 337843 bytes read, 2 seeks
 Exiting normally, received signal 2.
 }}}

 Test 2, video+audio file input w/ -vn, hangs until Ctrl-C,
 ffmpeg-20190613-070719.log:
 {{{
 ./ffmpeg "-report:level=99" -vn -i astreamselect20190613.mp4
 -filter_complex:a "astreamselect=inputs=2:map=1" test2out.aac

 Input file #0 (astreamselect20190613.mp4):
   Input stream #0:0 (video): 1 packets read (122932 bytes);
   Input stream #0:1 (audio): 3 packets read (797 bytes); 2 frames decoded
 (2048 samples);
   Input stream #0:2 (audio): 4 packets read (1325 bytes); 3 frames decoded
 (3072 samples);
   Total: 8 packets (125054 bytes) demuxed
 Output file #0 (test2out.aac):
   Output stream #0:0 (audio): 2 frames encoded (2048 samples); 3 packets
 muxed (967 bytes);
   Total: 3 packets (967 bytes) muxed
 5 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x7feae6c03600] Statistics: 0 seeks, 1 writeouts
 [aac @ 0x7feaea001600] Qavg: 225.886
 [AVIOContext @ 0x7feae6c00dc0] Statistics: 299484 bytes read, 5 seeks
 Exiting normally, received signal 2.
 }}}

 Test 3, both streams in single file, hangs until Ctrl-C,
 ffmpeg-20190613-070926.log and ffmpeg-20190613-070957.log
 {{{
 ./ffmpeg "-report:level=99" -vn -i astreamselect20190613.mp4 -map 0:1 -map
 0:2 -c:a copy audioonly.mp4

 Input file #0 (astreamselect20190613.mp4):
   Input stream #0:0 (video): 1 packets read (122932 bytes);
   Input stream #0:1 (audio): 236 packets read (80052 bytes);
   Input stream #0:2 (audio): 236 packets read (80511 bytes);
   Total: 473 packets (283495 bytes) demuxed
 Output file #0 (audioonly.mp4):
   Output stream #0:0 (audio): 236 packets muxed (80052 bytes);
   Output stream #0:1 (audio): 236 packets muxed (80511 bytes);
   Total: 472 packets (160563 bytes) muxed
 0 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x7fe682602ec0] Statistics: 2 seeks, 4 writeouts
 [AVIOContext @ 0x7fe68240f9c0] Statistics: 4834194 bytes read, 129 seeks

 ./ffmpeg "-report:level=99" -vn -i audioonly.mp4 -filter_complex:a
 "astreamselect=inputs=2:map=1" test3out.aac

 Input file #0 (audioonly.mp4):
   Input stream #0:0 (audio): 3 packets read (797 bytes); 2 frames decoded
 (2048 samples);
   Input stream #0:1 (audio): 4 packets read (1325 bytes); 3 frames decoded
 (3072 samples);
   Total: 7 packets (2122 bytes) demuxed
 Output file #0 (test3out.aac):
   Output stream #0:0 (audio): 2 frames encoded (2048 samples); 3 packets
 muxed (967 bytes);
   Total: 3 packets (967 bytes) muxed
 5 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x7f81c5c15980] Statistics: 0 seeks, 1 writeouts
 [aac @ 0x7f81c600f400] Qavg: 225.886
 [AVIOContext @ 0x7f81c5c0fb80] Statistics: 73414 bytes read, 2 seeks
 Exiting normally, received signal 2.
 }}}

 Test 4, simple audio files, successful, ffmpeg-20190613-071050.log and
 ffmpeg-20190613-071127.log
 {{{
 ./ffmpeg "-report:level=99" -vn -i astreamselect20190613.mp4 -map 0:1 -c:a
 copy stream1.aac -map 0:2 -c:a copy stream2.aac

 Input file #0 (astreamselect20190613.mp4):
   Input stream #0:0 (video): 1 packets read (122932 bytes);
   Input stream #0:1 (audio): 236 packets read (80052 bytes);
   Input stream #0:2 (audio): 236 packets read (80511 bytes);
   Total: 473 packets (283495 bytes) demuxed
 Output file #0 (stream1.aac):
   Output stream #0:0 (audio): 236 packets muxed (80052 bytes);
   Total: 236 packets (80052 bytes) muxed
 Output file #1 (stream2.aac):
   Output stream #1:0 (audio): 236 packets muxed (80511 bytes);
   Total: 236 packets (80511 bytes) muxed
 0 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x7fb6b56138c0] Statistics: 0 seeks, 1 writeouts
 [AVIOContext @ 0x7fb6b56147c0] Statistics: 0 seeks, 1 writeouts
 [AVIOContext @ 0x7fb6b5606f80] Statistics: 4834194 bytes read, 129 seeks

 ./ffmpeg "-report:level=99" -i stream1.aac -i stream2.aac
 -filter_complex:a "astreamselect=inputs=2:map=1" test4out.aac

 Input file #0 (stream1.aac):
   Input stream #0:0 (audio): 236 packets read (81704 bytes); 236 frames
 decoded (241664 samples);
   Total: 236 packets (81704 bytes) demuxed
 Input file #1 (stream2.aac):
   Input stream #1:0 (audio): 236 packets read (82163 bytes); 236 frames
 decoded (241664 samples);
   Total: 236 packets (82163 bytes) demuxed
 Output file #0 (test4out.aac):
   Output stream #0:0 (audio): 236 frames encoded (241664 samples); 237
 packets muxed (80777 bytes);
   Total: 237 packets (80777 bytes) muxed
 472 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x7fbf22701ac0] Statistics: 0 seeks, 1 writeouts
 [aac @ 0x7fbf23804a00] Qavg: 512.582
 [AVIOContext @ 0x7fbf22700640] Statistics: 114632 bytes read, 4 seeks
 [AVIOContext @ 0x7fbf22703a80] Statistics: 115091 bytes read, 4 seeks
 }}}

 I have also had similar issues if astreamselect is used in a complex audio
 filtergraph, but I haven't identified the minimal failure scenario.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7955>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list