Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • F ffmpeg-python
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 402
    • Issues 402
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 34
    • Merge requests 34
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Karl Kroening
  • ffmpeg-python
  • Issues
  • #42
Closed
Open
Issue created Dec 13, 2017 by Administrator@rootContributor

audio not copying ove when using concat and/or overlay

Created by: w-

first off, thanks for this great piece of software. It really does make working with ffmpeg way clearer.

I'm attempting to concat two videos and then stick an overlay on them. The video details are below in case they help.

Basically video 1 is a leader clip with audio stream that is blank, video 2 is actual content with audio stream and overlay image is transparent png

if i run as described below, Video renders fine, but no audio.

To narrow down the issue, I took out overlay and concat. (just resized video) audio copied over fine.

when adding the concat back in, i lose audio. i discovered it's because i need to pass the kwarg a=1 but after i do that, the encoding process hangs. probably because the audio streams are different formats.

I saw this issue https://github.com/kkroening/ffmpeg-python/issues/26 which seems to indicate ffmpeg-python is currently missing audio options.

Am I SOL here? or is there some way I can accomplish what i want. i.e.:

  • concatenate two videos together with audio
  • png overlay applied.

if i can get just the audio from video 2, that would be ok as well.

thanks in advance

p.s on a side note, how am i supposed to feed multiple map parameters into the ffmpeg-python? and how do i identify the streams? the ffmpeg syntax does something like 0:0 but output from ffmpeg-python has '[s0]'

out_config = {
    'x264opts': x264_params,
    'c:a': 'ac3',
    'b:a': '160k',
    's': '480x272',
    #'map': '[s0:1]',
    #'acodec': 'copy',
}

    ffmpeg
                .concat(
                    ffmpeg.input(target_leader_file),
                    ffmpeg.input(target_input_file),
                    a=1,
                    unsafe=True
                )
                #.overlay(ffmpeg.input(target_watermark_file))
                .output(target_output_file, **out_config)
                .overwrite_output()

1st video:

  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2016-05-09T14:58:08.000000Z
    com.apple.finalcutstudio.media.uuid: C23F6D00-710C-4D81-A9FD-A61C4DF24C3C
  Duration: 00:00:03.04, start: 0.000000, bitrate: 43535 kb/s
    Stream #0:0(eng): Video: prores (apcn / 0x6E637061), yuv422p10le(bt709, progressive), 1920x1080, 41965 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 2997 tbn, 2997 tbc (default)
    Metadata:
      creation_time   : 2016-05-09T14:58:08.000000Z
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422
      timecode        : 01:00:00:00
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2016-05-09T14:58:08.000000Z
      handler_name    : Apple Alias Data Handler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2016-05-09T14:58:08.000000Z
      handler_name    : Apple Alias Data Handler
      timecode        : 01:00:00:00

2nd video:

  Duration: 00:00:43.07, start: 0.511600, bitrate: 24045 kb/s
  Program 1
    Stream #1:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #1:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 256 kb/s
Assignee
Assign to
Time tracking