[FFmpeg-user] Non-mandatory audio

Mar Andrés López mar.andres.l at gmv.com
Thu Oct 15 11:54:56 EEST 2020


A lot of thanks, appending the ? is exactly what I was looking for,


ffmpeg -i INPUT -map 0:v -map 0:a? OUTPUT"


So, yes it is quite useful to know this.

________________________________
De: ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> en nombre de Greg Oliver <oliver.greg at gmail.com>
Enviado: miércoles, 14 de octubre de 2020 17:42:04
Para: FFmpeg user questions
Asunto: Re: [FFmpeg-user] Non-mandatory audio

On Wed, Oct 14, 2020 at 10:40 AM Will Boba <w_boba at hotmail.com> wrote:

> On 10/14/20 11:18 AM, Greg Oliver wrote:
> > sorry just realized I had to redirect stderr to get the results
> >
> > On Wed, Oct 14, 2020 at 10:17 AM Greg Oliver <oliver.greg at gmail.com>
> wrote:
> >
> >> On Tue, Oct 13, 2020 at 8:50 AM Mar Andrés López <mar.andres.l at gmv.com>
> >> wrote:
> >>
> >>> Dear all,
> >>>
> >>>
> >>> I am using the following command to generate dash content from a file:
> >>>
> >>>
> >>> ffmpeg -i video.mp4 –r 25 -c:v libx264 -c:a aac -b:a 128k -ac 1 -ar
> 44100
> >>> -map v:0 -b:v:0 2M -map v:0 -b:v:1 145k -map v:0 -b:v:2 365k -map 0:a
> -f
> >>> dash dash.mpd
> >>>
> >>>
> >>> But sometimes I have streams with audio and sometimes not. Is there
> >>> anyway to make this command to not break if the video file does not
> >>> contains audio?
> >>>
> >>>
> >>> A lot of thanks
> >>>
> >> Assuming you are scripting this, probe the file first and check for
> >> audio.  Use a separate ffmpeg command line for eac result.
> >>
> >> ffprobe <infile> | grep "Stream.*Audio"
> >> if [ $? -eq 0 ]; then
> >>      ffmpeg command with audio
> >> else
> >>      ffmpeg command without audio
> >> fi
> >>
> >
> > ffprobe <infile> 2>&1 | grep "Stream.*Audio"
> > if [ $? -eq 0 ]; then
> >      ffmpeg command with audio
> > else
> >      ffmpeg command without audio
> > fi
> > _______________________________________________
> > ffmpeg-user mailing list
> > ffmpeg-user at ffmpeg.org
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__ffmpeg.org_mailman_listinfo_ffmpeg-2Duser&d=DwIGaQ&c=CIoxZ4z5BqFvKvSGFOTo726QZIiNTc_M9CmngT-Pla4&r=6hC3rvTBWUFDzy12mBL-ibcRFc1EHXzwjcFCetQx-fY&m=RojyyflL7nSTHF-BunTTjqrEukKDkj7bdL9x2So3880&s=qnN1AU9shTJIhGwlYoyBF2-PzeyagaOxzVkKb8QKbMQ&e=
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
>  From here: https://urldefense.proofpoint.com/v2/url?u=https-3A__ffmpeg.org_ffmpeg-2Dall.html&d=DwIGaQ&c=CIoxZ4z5BqFvKvSGFOTo726QZIiNTc_M9CmngT-Pla4&r=6hC3rvTBWUFDzy12mBL-ibcRFc1EHXzwjcFCetQx-fY&m=RojyyflL7nSTHF-BunTTjqrEukKDkj7bdL9x2So3880&s=8lK6pe7Qvro3dTieuT_Nih4LFbQZamU8Xh0F363AGAY&e=
>
> "To map the video and audio streams from the first input, and using the
> trailing ?, ignore the audio mapping if no audio streams exist in the
> first input:
>
> ffmpeg -i INPUT -map 0:v -map 0:a? OUTPUT"
>
Even easier :)  Nice to know this exists.



>
> Will.
>
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__ffmpeg.org_mailman_listinfo_ffmpeg-2Duser&d=DwIGaQ&c=CIoxZ4z5BqFvKvSGFOTo726QZIiNTc_M9CmngT-Pla4&r=6hC3rvTBWUFDzy12mBL-ibcRFc1EHXzwjcFCetQx-fY&m=RojyyflL7nSTHF-BunTTjqrEukKDkj7bdL9x2So3880&s=qnN1AU9shTJIhGwlYoyBF2-PzeyagaOxzVkKb8QKbMQ&e=

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

P Please consider the environment before printing this e-mail.


More information about the ffmpeg-user mailing list