I wrote the following script that is meant to remove the unnecessary audio streams, aka dubbing, as well as subtitles from the movies in my collection:
#!/usr/bin/bash echo "What is the path to the source file?" read if of=$(echo "${if}"|sed -E 's/(\.)([avimp4kv]{3,3}$)/\1stripped.\2/') echo "What is the number of the audio stream that you want to copy?" read no ffmpeg -v 0 -i "${if}" -map 0:v -map 0:${no} "${of}" My intent is to save on storage while preserving the original quality of both video and audio stream of my choice. I noticed that the reduction of the size of the media files is very large. For example: Todo_Sobre_Mi_Madre_(1999).avi that has 1.4GB and the following streams:
Input #0, avi, from 'Todo_Sobre_Mi_Madre_(1999).avi': Metadata: encoder : VirtualDubMod 1.5.10.2 (build 2540/release) Duration: 01:41:24.67, start: 0.000000, bitrate: 1936 kb/s Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 720x304 [SAR 1:1 DAR 45:19], 1539 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 30k tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp, 192 kb/s Stream #0:2: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp, 192 kb/s was converted to Todo_Sobre_Mi_Madre_(1999).stripped.avi of only 248MB with the following streams:
Input #0, avi, from 'Todo_Sobre_Mi_Madre_(1999).stripped.avi': Metadata: encoder : Lavf58.29.100 Duration: 01:41:24.75, start: 0.000000, bitrate: 341 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 720x304 [SAR 1:1 DAR 45:19], 200 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 24k tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp, 128 kb/s I noticed the unintended reduction of the bitrate of both the video, from 1539 kb/s to just 200 kb/s and the audio stream, from 192 kb/s to just 128 kb/s. The resolution remained unchanged. What am I doing wrong? How might I utilize ffmpeg and its -map option to accomplish my goal?