I'm not sure, but the following command seems to do just that. Here I get the duration of the first audio stream of the mp4 file:
ffprobe -v error -select_streams a:0 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 -i input.mp4
However, I'm looking for the equivalent with ffmpeg (if it exists). Your answer is equally valid if it's that it's not possible to do that with ffmpeg
.