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