Adding audio track to MP4 seems to override the video stream

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding audio track to MP4 seems to override the video stream

Cyle Hunter
Hello,

I’m trying to add an audio track to an existing MP4 video. It seems when I add the new audio stream the video stream gets corrupted. Here’s the command that I’m running:

ffmpeg -y -I video.mp4 -i music.aac  -c copy -map 0:v:0 -map 1:a:0 video.mp4

I’m using the 3.4.1 release of ffmpeg available here: https://www.johnvansickle.com/ffmpeg/, interestingly I tested this command on my local machine with the same version and I didn’t have this issue.

Here’s the output.

ffmpeg version 3.4.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.4.0 (Debian 6.4.0-10) 20171112
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:46.00, start: 0.000000, bitrate: 30182 kb/s
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 30181 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
[aac @ 0x49321a0] Estimating duration from bitrate, this may be inaccurate
Input #1, aac, from ‘music.aac':
Duration: 00:00:48.88, bitrate: 136 kb/s
Stream #1:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 136 kb/s
Output #0, mp4, to ‘video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 30181 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 136 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=-1.0 Lsize= 1652kB time=00:00:51.08 bitrate= 264.9kbits/s speed=1.24e+03x
video:841kB audio:816kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

I would appreciate if anybody has any idea what the issue might be or how I could go about diagnosing this further.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Adding audio track to MP4 seems to override the video stream

Carl Eugen Hoyos-2
2018-01-10 7:37 GMT+01:00 Cyle Hunter <[hidden email]>:

> I’m trying to add an audio track to an existing MP4 video. It
> seems when I add the new audio stream the video stream gets
> corrupted.

Please test current FFmpeg git head, if the issue is reproducible
please provide an input sample.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Adding audio track to MP4 seems to override the video stream

Cyle Hunter
Hi, I built a new binary using the git head as per your suggestion. It seems to run a lot faster now, however, I’m running into the same issue.

Here’s the mp4 file without audio that I’m testing with:
https://file.io/nV9UTQ

And here’s what the output looks like after the I apply the sound:
https://file.io/4ls6Is

Here’s the sound file I’ve been testing with:
https://file.io/vF69i2

And here’s the log output on the latest version:

ffmpeg version N-89775-gef21033 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11)
configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/root/bin --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --disable-shared --enable-static
libavutil 56. 7.100 / 56. 7.100
libavcodec 58. 9.100 / 58. 9.100
libavformat 58. 3.100 / 58. 3.100
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 11.101 / 7. 11.101
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/62a5980d-b45c-40cb-a52d-0b308fed3b18.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.3.100
Duration: 00:00:46.00, start: 0.000000, bitrate: 3181 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 3180 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
[aac @ 0x45cb4c0] Estimating duration from bitrate, this may be inaccurate
Input #1, aac, from '/var/task/assets/elvis.aac':
Duration: 00:00:48.88, bitrate: 136 kb/s
Stream #1:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 136 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mp4, to '/tmp/62a5980d-b45c-40cb-a52d-0b308fed3b18.jpeg.zip.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.3.100
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 3180 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 256 kb/s
Metadata:
encoder : Lavc58.9.100 aac
frame= 1 fps=0.0 q=-1.0 Lsize= 229kB time=00:00:00.02 bitrate=80761.8kbits/s speed=1.73x
video:227kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.584858%
[aac @ 0x45bec80] Qavg: 51662.707


> On Jan 10, 2018, at 8:19 AM, Carl Eugen Hoyos <[hidden email]> wrote:
>
> 2018-01-10 7:37 GMT+01:00 Cyle Hunter <[hidden email]>:
>
>> I’m trying to add an audio track to an existing MP4 video. It
>> seems when I add the new audio stream the video stream gets
>> corrupted.
>
> Please test current FFmpeg git head, if the issue is reproducible
> please provide an input sample.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Adding audio track to MP4 seems to override the video stream

Cyle Hunter
Here’s some output from ffmprobe. It looks like it’s setting the video stream to 1 frame for some reason judging by the nb_read_frames=1

https://pastebin.com/tvhxZc0n

> On Jan 11, 2018, at 3:03 PM, Cyle Hunter <[hidden email]> wrote:
>
> Hi, I built a new binary using the git head as per your suggestion. It seems to run a lot faster now, however, I’m running into the same issue.
>
> Here’s the mp4 file without audio that I’m testing with:
> https://file.io/nV9UTQ
>
> And here’s what the output looks like after the I apply the sound:
> https://file.io/4ls6Is
>
> Here’s the sound file I’ve been testing with:
> https://file.io/vF69i2
>
> And here’s the log output on the latest version:
>
> ffmpeg version N-89775-gef21033 Copyright (c) 2000-2018 the FFmpeg developers
> built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11)
> configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/root/bin --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --disable-shared --enable-static
> libavutil 56. 7.100 / 56. 7.100
> libavcodec 58. 9.100 / 58. 9.100
> libavformat 58. 3.100 / 58. 3.100
> libavdevice 58. 0.100 / 58. 0.100
> libavfilter 7. 11.101 / 7. 11.101
> libswscale 5. 0.101 / 5. 0.101
> libswresample 3. 0.101 / 3. 0.101
> libpostproc 55. 0.100 / 55. 0.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/62a5980d-b45c-40cb-a52d-0b308fed3b18.mp4':
> Metadata:
> major_brand : isom
> minor_version : 512
> compatible_brands: isomiso2avc1mp41
> encoder : Lavf58.3.100
> Duration: 00:00:46.00, start: 0.000000, bitrate: 3181 kb/s
> Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 3180 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
> Metadata:
> handler_name : VideoHandler
> [aac @ 0x45cb4c0] Estimating duration from bitrate, this may be inaccurate
> Input #1, aac, from '/var/task/assets/elvis.aac':
> Duration: 00:00:48.88, bitrate: 136 kb/s
> Stream #1:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 136 kb/s
> Stream mapping:
> Stream #0:0 -> #0:0 (copy)
> Stream #1:0 -> #0:1 (aac (native) -> aac (native))
> Press [q] to stop, [?] for help
> Output #0, mp4, to '/tmp/62a5980d-b45c-40cb-a52d-0b308fed3b18.jpeg.zip.mp4':
> Metadata:
> major_brand : isom
> minor_version : 512
> compatible_brands: isomiso2avc1mp41
> encoder : Lavf58.3.100
> Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 3180 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
> Metadata:
> handler_name : VideoHandler
> Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 256 kb/s
> Metadata:
> encoder : Lavc58.9.100 aac
> frame= 1 fps=0.0 q=-1.0 Lsize= 229kB time=00:00:00.02 bitrate=80761.8kbits/s speed=1.73x
> video:227kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.584858%
> [aac @ 0x45bec80] Qavg: 51662.707
>
>
>> On Jan 10, 2018, at 8:19 AM, Carl Eugen Hoyos <[hidden email]> wrote:
>>
>> 2018-01-10 7:37 GMT+01:00 Cyle Hunter <[hidden email]>:
>>
>>> I’m trying to add an audio track to an existing MP4 video. It
>>> seems when I add the new audio stream the video stream gets
>>> corrupted.
>>
>> Please test current FFmpeg git head, if the issue is reproducible
>> please provide an input sample.
>>
>> Carl Eugen
>> _______________________________________________
>> ffmpeg-user mailing list
>> [hidden email]
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> [hidden email] with subject "unsubscribe".
>

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Adding audio track to MP4 seems to override the video stream

Carl Eugen Hoyos-2
In reply to this post by Cyle Hunter
2018-01-11 22:03 GMT+01:00 Cyle Hunter <[hidden email]>:

> Here’s the mp4 file without audio that I’m testing with:
> https://file.io/nV9UTQ
>
> And here’s what the output looks like after the I apply the sound:
> https://file.io/4ls6Is
>
> Here’s the sound file I’ve been testing with:
> https://file.io/vF69i2

All three are 404 here.

Please avoid top-posting here, Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".