ffmpeg-python icon indicating copy to clipboard operation
ffmpeg-python copied to clipboard

Help with concat diffrent media types together

Open Nosh-Ware opened this issue 4 years ago • 4 comments

import ffmpeg


input_still = ffmpeg.input("C:/Users/Nosh/Desktop/sample/1.mp3")
input_audio = ffmpeg.input("C:/Users/Nosh/Desktop/sample/1.jpg")

(
    ffmpeg
    .concat(input_still, input_audio, v=1, a=1)
    .output("output.mp4")
    .run(overwrite_output=True)
)

I am trying to concat an audio (sans video stream) and an image (sans audio stream) together. It seems to not like this, which after research seems to be because the image file has no audio stream and vice versa. How do I make this work? How do I make it show the image for the entire duration of the audio clip? Here is the longer output for more context:

[mjpeg @ 00000296a2930140] Found EOI before any SOF, ignoring
[mjpeg @ 00000296a2930140] No JPEG data found in image
Input #0, mp3, from 'C:/Users/Nosh/Desktop/sample/1.mp3':
Duration: 00:01:57.91, start: 0.046042, bitrate: 191 kb/s
 Stream #0:0: Audio: mp3, 24000 Hz, stereo, fltp, 160 kb/s
   Metadata:
     encoder         : LAME3.99r
 Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1500x1338 [SAR 1:1 DAR 250:223], 90k tbr, 90k tbn (attached pic)
   Metadata:
     comment         : Cover (front)
[mjpeg @ 00000296a2935f00] Found EOI before any SOF, ignoring
[mjpeg @ 00000296a2935f00] No JPEG data found in image
Input #1, image2, from 'C:/Users/Nosh/Desktop/sample/1.jpg':
 Duration: 00:00:00.04, start: 0.000000, bitrate: 55920 kb/s
 Stream #1:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 1600x1598 [SAR 72:72 DAR 800:799], 25 fps, 25 tbr, 25 tbn
Stream specifier '' in filtergraph description [0][1]concat=a=1:n=1:v=1[s0] matches no streams.
Traceback (most recent call last):
 File "C:\Users\Nosh\Desktop\TempEmailMaker.py", line 8, in <module>
   ffmpeg
 File "C:\Users\Nosh\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\ffmpeg\_run.py", line 325, in run
   raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

Nosh-Ware avatar May 14 '21 23:05 Nosh-Ware

Same problem here. Adding audio and still images streams in the same file it is a nightmare. Each audio format has its nuances, and it takes a lot of metadata fine tuning to get it compatible. Can your python wrapper make things easier with some smart functions?

Emasoft avatar Feb 01 '23 16:02 Emasoft

I guess that would be a question for the devs, not me. I resorted to just calling the CLI directly myself, and it works reasonably well. If this isn't already planed, could smart functions be considered for this module in some way?

Nosh-Ware avatar Mar 21 '23 15:03 Nosh-Ware

Thanks for your reply

On Tue, Mar 21, 2023, 6:11 PM Nosh (97) Ware @.***> wrote:

I guess that would be a question for the devs, not me. I resorted to just calling the CLI directly myself, and it works reasonably well. If this isn't already planed, could smart functions be considered for this module in some way?

— Reply to this email directly, view it on GitHub https://github.com/kkroening/ffmpeg-python/issues/551#issuecomment-1478014266, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJX7BYNH5OZUMBIKG2IEYTLW5HAKHANCNFSM445I2OEQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

developerek avatar Mar 21 '23 15:03 developerek

Your welcome. I guess a good holdover for now would just be switching that the CLI entirely as there is more documented support and tutorials if you find that the features you need refuse to work. At least that's what worked for me...

No need to abandon ship though if the module works for what you need it to do. When it works it works a lot better.

Nosh-Ware avatar Apr 28 '23 22:04 Nosh-Ware