M
M
Metallyrg2019-07-18 04:12:37
Video
Metallyrg, 2019-07-18 04:12:37

Rebuild container or encode FFMPEG?

I have a python script that encodes a video from webm format to mp4. The video should not change, and the question is, is it possible to somehow simply rebuild the container, and not encode each video frame by frame?
The code works through the library
https://github.com/kkroening/ffmpeg-python/blob/ma...

import ffmpeg
(
    ffmpeg
    .input('/var/development/decode_webm/1.webm')
    .output('/var/development/webm_upload/1.mp4')
    .run()
)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Moskus, 2019-07-18
@Metallyrg

Most likely like this:

import ffmpeg
(
    ffmpeg
    .input('/var/development/decode_webm/1.webm')
    .output('/var/development/webm_upload/1.mp4', vcodec=copy, acodec=copy)
    .run()
)

But the syntax there is idiotic and doesn't match pure ffmpeg. Is it important for you to do this in python? The console will be easier.

S
sardigital, 2020-01-19
@sardigital

you can run ffmpeg through subprocess and wait for execution.
https://docs.python.org/3/library/subprocess.html#...

check_call(['ffmpeg', '-v', 'warning', '-y', '-f', 'concat', '-i', input_path, '-c', 'copy', '-c:v', 'h264', '-c:a', 'mp2', '-preset', 'ultrafast', output_path])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question