How to Transcode ALL Audio streams from input to output using ffmpeg?
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 It converted it into 'maud_test.ts' with following contents (shown by ffprobe) Input #0, mpegts, from 'maud_test.ts': Duration: 00:00:57.25, start: 1.400000, bitrate: 2211 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: 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[0x101](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, 6 channels, fltp, 391 kb/s Stream #0:2[0x102](spa): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 133 kb/s So it appeared as if the command worked....However when I play the maud_test.ts file in vlc player I can see both audio streams listed in the menu; but Stream 1 (eng) remains silent............whereas Stream 2 (spa) has proper audio. (Original TS file has both audio streams properly audible) I have tried this with different input files and have seen that same problem occurs in each case. What that I am doing is not right? How should I get this done? (*I can write explicit stream by stream map and channel arguments to get that done; however I want the command line to be generic, in that the input file could be having any configuration with one Video and several Audios with different formats. The configuration will not be known beforehand.*)
On 11/24/22 08:29, Mahesh Velankar wrote:
I have an input MPEG TS file 'unit_test.ts'. This file has following content (shown by ffprobe): ...
I tried this command:
ffmpeg -i unit_test.ts -map 0 -c copy -c:a aac maud_test.ts ... What that I am doing is not right?
I may not be correct, but I believe that '-c:a' defaults to solely the 1st audio stream.
How should I get this done? (*I can write explicit stream by stream map and channel arguments to get that done;
I believe that's what you have to do.
however I want the command line to be generic,
I believe that is not possible as FFmpeg is currently implemented.
On 11/24/2022 9:27 AM, Mark Filipak wrote:
ffmpeg -i unit_test.ts -map 0 -c copy -c:a aac maud_test.ts ... What that I am doing is not right?
I may not be correct, but I believe that '-c:a' defaults to solely the 1st audio stream.
(no time to try this) The '-c copy' would copy all streams and '-c:a' should then match all audio streams. However, the doc says that when -map is used only the user-mapped streams are included. Try removing that? Later, z!
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
participants (4)
-
Carl Zwanzig -
Mahesh Velankar -
Mark Filipak -
pehache