Quantcast
Channel: MediaSPIP
Viewing all articles
Browse latest Browse all 118048

Basic to use FFMPEG in Python (Django Rest Framework)

$
0
0

I'm writing a viewset in Django Rest Framework to convert images sequence into video by using FFMPEG but I don't understand how I can do it. I tried but not success. Please help me with my code.

My code:

class VideoRenderSerializer(ModelSerializer): imageSequence = ListField(required=False, child=FileField(max_length=100000, allow_empty_file=False, use_url=False)) class Meta: model = Video fields = [ 'imageSequence', ] class VideoRenderView(ModelViewSet): queryset = Video.objects.all() serializer_class = VideoRenderSerializer def render_video(self, request): imgSequences = request.FILES.getlist('imageSequence') render_from_img_sequences_cmd = 'ffmpeg -loop 1 -i image.png -vf format=yuv420p -t 30 C:\output.mp4' ffmpegresult = subprocess.call(render_from_img_sequences_cmd, shell=True, stdout=open(os.devnull, "w"), stderr=subprocess.STDOUT) return Response(ffmpegresult, status=200)

Output is: 1 and I cant find where is output file!


Viewing all articles
Browse latest Browse all 118048

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>