[FFmpeg-user] How to Transcode ALL Audio streams from input to output using ffmpeg?

pehache pehache.7 at gmail.com
Fri Nov 25 22:21:44 EET 2022


Le 24/11/2022 à 14:29, Mahesh Velankar a écrit :
> I have an input MPEG TS file 'unit_test.ts'. This file has following
> content (shown by ffprobe):
> 
> Input #0, mpegts, from 'unit_test.ts':
>    Duration: 00:00:57.23, start: 73674.049844, bitrate: 2401 kb/s
>    Program 1
>      Metadata:
>        service_name    : Service01
>        service_provider: FFmpeg
>      Stream #0:0[0x31]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
> yuv420p(progressive), 852x480 [SAR 640:639 DAR 16:9], Closed Captions,
> 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
>      Stream #0:1[0x34](eng): Audio: ac3 ([129][0][0][0] / 0x0081),
> 48000 Hz, 5.1(side), fltp, 448 kb/s
>      Stream #0:2[0x35](spa): Audio: ac3 ([129][0][0][0] / 0x0081),
> 48000 Hz, stereo, fltp, 192 kb/s
> 
> I want to convert it into another MPEG TS file. Requirement is that the
> Video stream of the input should be directly copied to the output whereas
> *ALL* the audio streams should be transcoded "aac" format.
> 
> I tried this command:
> 
> ffmpeg -i unit_test.ts -map 0 -c copy -c:a aac maud_test.ts


Try this (and show the ffprobe of the output file) :

ffmpeg -i unit_test.ts -map 0 -c:v copy -c:a aac -ac:a:0 6 -ac:a:1 2 
maud_test.ts



More information about the ffmpeg-user mailing list