0

How can I delete the last stream from this video file?

$ ffmpeg -i video.mp4
...
    Stream #0:0(und): Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuv422p10le, 480x270 [SAR 1:1 DAR 16:9], 172 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : SoundHandler
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 119 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      handler_name    : SoundHandler
      timecode        : 00:00:00:00
At least one output file must be specified

I want to delete the stream called Stream #0:2.

I tried

ffmpeg -i video.mp4 -map 0 -map -0:2 out.mp4

But that still has three streams.

I've also tried

ffmpeg -i video.mp4 -map 0 -map -0:d:0 out.mp4

and -map -0:d according to my interpretation of this answer, but the ffmpeg -i results still show that there are three tracks in the output.

I have also tried these two

ffmpeg -i in.mp4 -c:v copy -c:a copy -map_chapters -1 out.mp4
ffmpeg -i in.mp4 -c copy -dn -map_metadata:c -1 out.mp4

from this question but neither work. There are still three streams and they look identical to ffmpeg -i in.mp4

theonlygusti
  • 11,032
  • 11
  • 64
  • 119

1 Answers1

0

I found a way that worked at last: https://superuser.com/a/685911/325613

ffmpeg -i 01300.mov -filter_complex "[0:v]null[video_out];[0:a]anull[audio_out]" -map [video_out] -map [audio_out] out.mov

In zsh I had to escape these: -map \[video_out\] -map \[audio_out\].

theonlygusti
  • 11,032
  • 11
  • 64
  • 119
  • The [duplicate question](https://stackoverflow.com/questions/65153578/invalid-data-stream-in-media-could-not-be-discarded-by-ffmpeg-why-is-it-staying) has a much better solution. – llogan Jun 30 '21 at 16:42