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
  • #563
Closed
Open
Issue created Jun 16, 2021 by Administrator@rootContributor

Display static image if the input stream ends?

Created by: Kyrilasa

Hello!

I'm wondering if it is possible to make a program to act like this:

-from an RTMP input stream restream it to an output stream but if the input stream ends, display a static black image.

So i tried to do it such way that i overlay the input stream to a constant stream of black image. I've been trying to make it work and it is absolutely fine, until the overlayed stream(the input stream) ends, the ffmpeg will stop, and won't continue, no black static image either,it just froze.

Any ideas how to make it work? And if you have another solution to this problem please do not keep it for yourself :D

def start_ffmpeg_process2(in_filename, out_filename):
    logger.info('Starting ffmpeg process2 output stream')
    base = ffmpeg.input(STATIC_IMAGE)['v'] \
                    .filter('scale', size='{w}x{h}'.format(w=OVERLAY_STREAM_VIDEO_WIDTH,
                                                           h=OVERLAY_STREAM_VIDEO_HEIGHT))\
                    
    overlay = ffmpeg.input(in_filename)
    # logger.info(center)
    c_final = ffmpeg.overlay(base,overlay['v'],eof_action='pass')
    
    args = (
        ffmpeg
        .output(c_final,overlay['a'],out_filename,format="flv",vcodec="libx264",
                preset="ultrafast", pix_fmt='yuv420p',
                tune="fastdecode,zerolatency",vb=1000*1500,
                acodec="aac", ar=48000,maxrate='1M',bufsize='2M',max_muxing_queue_size=9999)
        .global_args("-re")
        .compile()# Here you can specify as cmd='ffmpeg' keyword arg what ffmpeg to use
    )
    return subprocess.Popen(args, stdin=subprocess.PIPE)
Assignee
Assign to
Time tracking