Non-mandatory audio

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Non-mandatory audio

Mar Andrés López
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

P Please consider the environment before printing this e-mail.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Non-mandatory audio

Greg Oliver
On Tue, Oct 13, 2020 at 8:50 AM Mar Andrés López <[hidden email]>
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
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Non-mandatory audio

Greg Oliver
sorry just realized I had to redirect stderr to get the results

On Wed, Oct 14, 2020 at 10:17 AM Greg Oliver <[hidden email]> wrote:

> On Tue, Oct 13, 2020 at 8:50 AM Mar Andrés López <[hidden email]>
> 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
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Non-mandatory audio

w_boba

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 <[hidden email]> wrote:
>
>> On Tue, Oct 13, 2020 at 8:50 AM Mar Andrés López <[hidden email]>
>> 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
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

 From here: https://ffmpeg.org/ffmpeg-all.html

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


Will.


_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Non-mandatory audio

Greg Oliver
On Wed, Oct 14, 2020 at 10:40 AM Will Boba <[hidden email]> 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 <[hidden email]>
> wrote:
> >
> >> On Tue, Oct 13, 2020 at 8:50 AM Mar Andrés López <[hidden email]>
> >> 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
> > [hidden email]
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> > To unsubscribe, visit link above, or email
> > [hidden email] with subject "unsubscribe".
>
>  From here: https://ffmpeg.org/ffmpeg-all.html
>
> "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
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Non-mandatory audio

Mar Andrés López
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 <[hidden email]> en nombre de Greg Oliver <[hidden email]>
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 <[hidden email]> 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 <[hidden email]>
> wrote:
> >
> >> On Tue, Oct 13, 2020 at 8:50 AM Mar Andrés López <[hidden email]>
> >> 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
> > [hidden email]
> > 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
> > [hidden email] 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
[hidden email]
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
[hidden email] with subject "unsubscribe".

P Please consider the environment before printing this e-mail.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".