FFMPEG: change input without stoping proccess

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite
1












how i can change input on ffmpeg without stop process on linux Debian 9? im user decklink input and i need to change to file mp4 input.



ffmpeg -f decklink -i 'DeckLink Mini Recorder' -vf setpts=PTS-STARTPTS -pix_fmt uyvy422 -s 1920x1080 -r 25000/1000 -f decklink 'DeckLink Mini Monitor'






share|improve this question



















  • ffmpeg can't reconfigure input mid-process.
    – Gyan
    Jul 11 at 5:22














up vote
0
down vote

favorite
1












how i can change input on ffmpeg without stop process on linux Debian 9? im user decklink input and i need to change to file mp4 input.



ffmpeg -f decklink -i 'DeckLink Mini Recorder' -vf setpts=PTS-STARTPTS -pix_fmt uyvy422 -s 1920x1080 -r 25000/1000 -f decklink 'DeckLink Mini Monitor'






share|improve this question



















  • ffmpeg can't reconfigure input mid-process.
    – Gyan
    Jul 11 at 5:22












up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





how i can change input on ffmpeg without stop process on linux Debian 9? im user decklink input and i need to change to file mp4 input.



ffmpeg -f decklink -i 'DeckLink Mini Recorder' -vf setpts=PTS-STARTPTS -pix_fmt uyvy422 -s 1920x1080 -r 25000/1000 -f decklink 'DeckLink Mini Monitor'






share|improve this question











how i can change input on ffmpeg without stop process on linux Debian 9? im user decklink input and i need to change to file mp4 input.



ffmpeg -f decklink -i 'DeckLink Mini Recorder' -vf setpts=PTS-STARTPTS -pix_fmt uyvy422 -s 1920x1080 -r 25000/1000 -f decklink 'DeckLink Mini Monitor'








share|improve this question










share|improve this question




share|improve this question









asked Jul 10 at 22:23









admin883

6




6











  • ffmpeg can't reconfigure input mid-process.
    – Gyan
    Jul 11 at 5:22
















  • ffmpeg can't reconfigure input mid-process.
    – Gyan
    Jul 11 at 5:22















ffmpeg can't reconfigure input mid-process.
– Gyan
Jul 11 at 5:22




ffmpeg can't reconfigure input mid-process.
– Gyan
Jul 11 at 5:22










2 Answers
2






active

oldest

votes

















up vote
1
down vote













For any other person looking forward to this answer I got to the following solution (using python and CV2):



STEP 1:
Run your camera (or any other ffmpeg input) live locally



ffmpeg -i /dev/video0 -b 50k -r 20 -s 720x480 -f mpegts udp://127.0.0.1:2000 


STEP 2:
Have the ad or video you want to be displayed with the resolution as your input and most importantly saved as a .3gp video file.
STEP 3: Write a switcher.py file in the same directory as your .3gp file



import cv2
import sys
def main(argv):
adName = argv[0]
cap = cv2.VideoCapture("udp://127.0.0.1:2000")
showAd = 2
while cap.isOpened():
if showAd == 1:
cap.release()
del cap
cap = cv2.VideoCapture(adName)
showAd = 0
if showAd == 2:
cap.release()
del cap
cap = cv2.VideoCapture("udp://127.0.0.1:2000")
showAd = 0

ret, frame = cap.read()
try:
height, width, channels = frame.shape
except:
cap.release()
del cap
cap = cv2.VideoCapture("udp://127.0.0.1:2000")
key = cv2.waitKey(33)
if key==27:
showAd = 1
if key==32:
showAd = 2

if(ret):
sys.stdout.write(frame.tostring())
cv2.imshow("frame",frame)


cap.release()

if __name__ == "__main__":
main(sys.argv[1:])


STEP 5: Run the switcher.py with your ad name afterward and your output.



python switcher.py ad.3gp| ffplay -f rawvideo -pixel_format bgr24 -video_size 720x480 -i - 


STEP 6:
Hit "Esc" to show your ad!



REMEMBER TO CHANGE THE SCREEN VALUES!



Hope I've helped someone! (Probably I'll do some edits to this post)






share|improve this answer




























    up vote
    0
    down vote













    Hmmm, I can't understand your question very well...



    If you are having problems in using DeckLink and ffmpeg those website might be useful:



    https://www.ffmpeg.org/ffmpeg-devices.html#decklink



    https://trac.ffmpeg.org/wiki/Capture/Blackmagic



    If you are trying to switch from one DeckLink to a camera or other recording device, then I'm afraid to say you will need to code a "switcher" (probably, if streaming, the stream is going to stop). If you need any help with the coding e-mail me! (I don't have enough reputation to comment)






    share|improve this answer





















    • yes. i need switch input wihout going to stop. where ur email i can see?
      – admin883
      Jul 11 at 9:10










    • @admin883 gustavomperedo@gmail.com
      – Gustavo Machado
      Jul 11 at 12:45










    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454580%2fffmpeg-change-input-without-stoping-proccess%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    For any other person looking forward to this answer I got to the following solution (using python and CV2):



    STEP 1:
    Run your camera (or any other ffmpeg input) live locally



    ffmpeg -i /dev/video0 -b 50k -r 20 -s 720x480 -f mpegts udp://127.0.0.1:2000 


    STEP 2:
    Have the ad or video you want to be displayed with the resolution as your input and most importantly saved as a .3gp video file.
    STEP 3: Write a switcher.py file in the same directory as your .3gp file



    import cv2
    import sys
    def main(argv):
    adName = argv[0]
    cap = cv2.VideoCapture("udp://127.0.0.1:2000")
    showAd = 2
    while cap.isOpened():
    if showAd == 1:
    cap.release()
    del cap
    cap = cv2.VideoCapture(adName)
    showAd = 0
    if showAd == 2:
    cap.release()
    del cap
    cap = cv2.VideoCapture("udp://127.0.0.1:2000")
    showAd = 0

    ret, frame = cap.read()
    try:
    height, width, channels = frame.shape
    except:
    cap.release()
    del cap
    cap = cv2.VideoCapture("udp://127.0.0.1:2000")
    key = cv2.waitKey(33)
    if key==27:
    showAd = 1
    if key==32:
    showAd = 2

    if(ret):
    sys.stdout.write(frame.tostring())
    cv2.imshow("frame",frame)


    cap.release()

    if __name__ == "__main__":
    main(sys.argv[1:])


    STEP 5: Run the switcher.py with your ad name afterward and your output.



    python switcher.py ad.3gp| ffplay -f rawvideo -pixel_format bgr24 -video_size 720x480 -i - 


    STEP 6:
    Hit "Esc" to show your ad!



    REMEMBER TO CHANGE THE SCREEN VALUES!



    Hope I've helped someone! (Probably I'll do some edits to this post)






    share|improve this answer

























      up vote
      1
      down vote













      For any other person looking forward to this answer I got to the following solution (using python and CV2):



      STEP 1:
      Run your camera (or any other ffmpeg input) live locally



      ffmpeg -i /dev/video0 -b 50k -r 20 -s 720x480 -f mpegts udp://127.0.0.1:2000 


      STEP 2:
      Have the ad or video you want to be displayed with the resolution as your input and most importantly saved as a .3gp video file.
      STEP 3: Write a switcher.py file in the same directory as your .3gp file



      import cv2
      import sys
      def main(argv):
      adName = argv[0]
      cap = cv2.VideoCapture("udp://127.0.0.1:2000")
      showAd = 2
      while cap.isOpened():
      if showAd == 1:
      cap.release()
      del cap
      cap = cv2.VideoCapture(adName)
      showAd = 0
      if showAd == 2:
      cap.release()
      del cap
      cap = cv2.VideoCapture("udp://127.0.0.1:2000")
      showAd = 0

      ret, frame = cap.read()
      try:
      height, width, channels = frame.shape
      except:
      cap.release()
      del cap
      cap = cv2.VideoCapture("udp://127.0.0.1:2000")
      key = cv2.waitKey(33)
      if key==27:
      showAd = 1
      if key==32:
      showAd = 2

      if(ret):
      sys.stdout.write(frame.tostring())
      cv2.imshow("frame",frame)


      cap.release()

      if __name__ == "__main__":
      main(sys.argv[1:])


      STEP 5: Run the switcher.py with your ad name afterward and your output.



      python switcher.py ad.3gp| ffplay -f rawvideo -pixel_format bgr24 -video_size 720x480 -i - 


      STEP 6:
      Hit "Esc" to show your ad!



      REMEMBER TO CHANGE THE SCREEN VALUES!



      Hope I've helped someone! (Probably I'll do some edits to this post)






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        For any other person looking forward to this answer I got to the following solution (using python and CV2):



        STEP 1:
        Run your camera (or any other ffmpeg input) live locally



        ffmpeg -i /dev/video0 -b 50k -r 20 -s 720x480 -f mpegts udp://127.0.0.1:2000 


        STEP 2:
        Have the ad or video you want to be displayed with the resolution as your input and most importantly saved as a .3gp video file.
        STEP 3: Write a switcher.py file in the same directory as your .3gp file



        import cv2
        import sys
        def main(argv):
        adName = argv[0]
        cap = cv2.VideoCapture("udp://127.0.0.1:2000")
        showAd = 2
        while cap.isOpened():
        if showAd == 1:
        cap.release()
        del cap
        cap = cv2.VideoCapture(adName)
        showAd = 0
        if showAd == 2:
        cap.release()
        del cap
        cap = cv2.VideoCapture("udp://127.0.0.1:2000")
        showAd = 0

        ret, frame = cap.read()
        try:
        height, width, channels = frame.shape
        except:
        cap.release()
        del cap
        cap = cv2.VideoCapture("udp://127.0.0.1:2000")
        key = cv2.waitKey(33)
        if key==27:
        showAd = 1
        if key==32:
        showAd = 2

        if(ret):
        sys.stdout.write(frame.tostring())
        cv2.imshow("frame",frame)


        cap.release()

        if __name__ == "__main__":
        main(sys.argv[1:])


        STEP 5: Run the switcher.py with your ad name afterward and your output.



        python switcher.py ad.3gp| ffplay -f rawvideo -pixel_format bgr24 -video_size 720x480 -i - 


        STEP 6:
        Hit "Esc" to show your ad!



        REMEMBER TO CHANGE THE SCREEN VALUES!



        Hope I've helped someone! (Probably I'll do some edits to this post)






        share|improve this answer













        For any other person looking forward to this answer I got to the following solution (using python and CV2):



        STEP 1:
        Run your camera (or any other ffmpeg input) live locally



        ffmpeg -i /dev/video0 -b 50k -r 20 -s 720x480 -f mpegts udp://127.0.0.1:2000 


        STEP 2:
        Have the ad or video you want to be displayed with the resolution as your input and most importantly saved as a .3gp video file.
        STEP 3: Write a switcher.py file in the same directory as your .3gp file



        import cv2
        import sys
        def main(argv):
        adName = argv[0]
        cap = cv2.VideoCapture("udp://127.0.0.1:2000")
        showAd = 2
        while cap.isOpened():
        if showAd == 1:
        cap.release()
        del cap
        cap = cv2.VideoCapture(adName)
        showAd = 0
        if showAd == 2:
        cap.release()
        del cap
        cap = cv2.VideoCapture("udp://127.0.0.1:2000")
        showAd = 0

        ret, frame = cap.read()
        try:
        height, width, channels = frame.shape
        except:
        cap.release()
        del cap
        cap = cv2.VideoCapture("udp://127.0.0.1:2000")
        key = cv2.waitKey(33)
        if key==27:
        showAd = 1
        if key==32:
        showAd = 2

        if(ret):
        sys.stdout.write(frame.tostring())
        cv2.imshow("frame",frame)


        cap.release()

        if __name__ == "__main__":
        main(sys.argv[1:])


        STEP 5: Run the switcher.py with your ad name afterward and your output.



        python switcher.py ad.3gp| ffplay -f rawvideo -pixel_format bgr24 -video_size 720x480 -i - 


        STEP 6:
        Hit "Esc" to show your ad!



        REMEMBER TO CHANGE THE SCREEN VALUES!



        Hope I've helped someone! (Probably I'll do some edits to this post)







        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered Jul 20 at 20:43









        Gustavo Machado

        183




        183






















            up vote
            0
            down vote













            Hmmm, I can't understand your question very well...



            If you are having problems in using DeckLink and ffmpeg those website might be useful:



            https://www.ffmpeg.org/ffmpeg-devices.html#decklink



            https://trac.ffmpeg.org/wiki/Capture/Blackmagic



            If you are trying to switch from one DeckLink to a camera or other recording device, then I'm afraid to say you will need to code a "switcher" (probably, if streaming, the stream is going to stop). If you need any help with the coding e-mail me! (I don't have enough reputation to comment)






            share|improve this answer





















            • yes. i need switch input wihout going to stop. where ur email i can see?
              – admin883
              Jul 11 at 9:10










            • @admin883 gustavomperedo@gmail.com
              – Gustavo Machado
              Jul 11 at 12:45














            up vote
            0
            down vote













            Hmmm, I can't understand your question very well...



            If you are having problems in using DeckLink and ffmpeg those website might be useful:



            https://www.ffmpeg.org/ffmpeg-devices.html#decklink



            https://trac.ffmpeg.org/wiki/Capture/Blackmagic



            If you are trying to switch from one DeckLink to a camera or other recording device, then I'm afraid to say you will need to code a "switcher" (probably, if streaming, the stream is going to stop). If you need any help with the coding e-mail me! (I don't have enough reputation to comment)






            share|improve this answer





















            • yes. i need switch input wihout going to stop. where ur email i can see?
              – admin883
              Jul 11 at 9:10










            • @admin883 gustavomperedo@gmail.com
              – Gustavo Machado
              Jul 11 at 12:45












            up vote
            0
            down vote










            up vote
            0
            down vote









            Hmmm, I can't understand your question very well...



            If you are having problems in using DeckLink and ffmpeg those website might be useful:



            https://www.ffmpeg.org/ffmpeg-devices.html#decklink



            https://trac.ffmpeg.org/wiki/Capture/Blackmagic



            If you are trying to switch from one DeckLink to a camera or other recording device, then I'm afraid to say you will need to code a "switcher" (probably, if streaming, the stream is going to stop). If you need any help with the coding e-mail me! (I don't have enough reputation to comment)






            share|improve this answer













            Hmmm, I can't understand your question very well...



            If you are having problems in using DeckLink and ffmpeg those website might be useful:



            https://www.ffmpeg.org/ffmpeg-devices.html#decklink



            https://trac.ffmpeg.org/wiki/Capture/Blackmagic



            If you are trying to switch from one DeckLink to a camera or other recording device, then I'm afraid to say you will need to code a "switcher" (probably, if streaming, the stream is going to stop). If you need any help with the coding e-mail me! (I don't have enough reputation to comment)







            share|improve this answer













            share|improve this answer



            share|improve this answer











            answered Jul 11 at 1:03









            Gustavo Machado

            183




            183











            • yes. i need switch input wihout going to stop. where ur email i can see?
              – admin883
              Jul 11 at 9:10










            • @admin883 gustavomperedo@gmail.com
              – Gustavo Machado
              Jul 11 at 12:45
















            • yes. i need switch input wihout going to stop. where ur email i can see?
              – admin883
              Jul 11 at 9:10










            • @admin883 gustavomperedo@gmail.com
              – Gustavo Machado
              Jul 11 at 12:45















            yes. i need switch input wihout going to stop. where ur email i can see?
            – admin883
            Jul 11 at 9:10




            yes. i need switch input wihout going to stop. where ur email i can see?
            – admin883
            Jul 11 at 9:10












            @admin883 gustavomperedo@gmail.com
            – Gustavo Machado
            Jul 11 at 12:45




            @admin883 gustavomperedo@gmail.com
            – Gustavo Machado
            Jul 11 at 12:45












             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454580%2fffmpeg-change-input-without-stoping-proccess%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay