Recherche avancée

Médias (0)

Mot : - Tags -/alertes

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (43)

Sur d’autres sites (8531)

  • FFMPEG Flutter : attaching captions to a video issue

    24 juillet 2024, par Aqib Javed

    I am working on an app where i first extract audio from a video, then transcribe it and then i wanna attach that transcribed captions or subtitles to the original video.

    


    Everything is working smooth except the subtitles attaching part
if im running the FFMPEG command directly in terminal, it works fine but not in flutter

    


    here is my code of attaching the subtitles to the video :

    


     Future<void> attachCaptionsToVideo(DeepGramResponse deepGramResponse) async {&#xA;    var tempDir = await getTemporaryDirectory();&#xA;&#xA;    final outputPath = "${tempDir.path}/outputWithCaptions.mp4";&#xA;    final String subtitlePath = deepGramResponse.captionsPath&#xA;        .replaceAll(&#x27;\\&#x27;, &#x27;\\\\&#x27;)&#xA;        .replaceAll(&#x27; &#x27;, &#x27;\\ &#x27;);&#xA;    final String command =&#xA;        &#x27;-y -i ${deepGramResponse.videoPath} -vf subtitles=$subtitlePath $outputPath&#x27;;&#xA;    await FFmpegKit.executeAsync(command, (session) async {&#xA;      final returnCode = await session.getReturnCode();&#xA;      final output = await session.getOutput();&#xA;      final error = await session.getFailStackTrace();&#xA;&#xA;      log(&#x27;FFmpeg command executed with return code: $returnCode&#x27;);&#xA;      if (ReturnCode.isSuccess(returnCode)) {&#xA;        log(&#x27;Captions attached successfully&#x27;);&#xA;        deepGramResponse.copyWith(&#xA;          videoPath: outputPath,&#xA;        );&#xA;        Get.to(() => VideoPlayerScreen(videoPath: outputPath));&#xA;      } else {&#xA;        log(&#x27;FFmpeg command failed&#x27;);&#xA;        log(&#x27;Error output: $output&#x27;);&#xA;        log(&#x27;Error details: $error&#x27;);&#xA;        Fluttertoast.showToast(&#xA;            msg: &#x27;Something went wrong, please try again later&#x27;);&#xA;      }&#xA;    });&#xA;  }&#xA;</void>

    &#xA;

    here is the error im getting :

    &#xA;

    &#xA;

    [AVFilterGraph @ 0x7b8a3f35f0] No option name near&#xA;'/data/user/0/com.example.blink/app_flutter/captions.srt'&#xA;[AVFilterGraph @ 0x7b8a3f35f0] Error parsing a filter description around :&#xA;[AVFilterGraph @ 0x7b8a3f35f0] Error parsing filterchain 'subtitles=/data/user/0/com.example.blink/app_flutter/captions.srt'&#xA;around :&#xA;Error reinitializing filters !&#xA;Failed to inject frame into filter network : Invalid argument&#xA;Error while processing the decoded data for stream #0:0&#xA;Conversion failed !

    &#xA;

    &#xA;

  • FFMPEG combining 2 command to make multiple overlay [closed]

    11 avril 2020, par Nano Wibisono

    I have two different commands and both work. but here I have a problem, how to combine these two commands into one output

    &#xA;&#xA;

    the first command is to add a video overlay

    &#xA;&#xA;

    ffmpeg -i   final.mp4    -vf "movie=LOGO.mov, scale=100: -1 [inner]; [in][inner] overlay =10: 10 [out] " completed.mp4&#xA;

    &#xA;&#xA;

    the second command is to add a text overlay

    &#xA;&#xA;

    ffmpeg -i final.mp4 -vf drawtext="fontfile=C\\:/Windows/Fonts/arial.ttf:fontsize=20: fontcolor=red:x=10:y=50:text=&#x27;test tect&#x27;" completedtextGB.mp4&#xA;

    &#xA;&#xA;

    I was wondering is it possible to combine these into the 1 command ?

    &#xA;&#xA;

    Thanks&#xA;Nano

    &#xA;

  • Audio async after using setpts, converting to ts and concatenating

    11 janvier 2018, par Aurelius Schnitzler

    I am using f.i.

    ffmpeg -y -ss 00:00:09.664 -t 00:00:06.939 -i "test.mp4" -an -c:v libx264 -filter:v "setpts=0.1*PTS" test2.mp4

    to speed up a video by 10.

    But there is still audio in it when being used with

    ffmpeg -y -i test2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts 2f.ts

    and

    ffmpeg -y -i "concat:2f.ts|..." -bsf:a aac_adtstoasc -movflags faststart -c copy final.mp4

    later on, yet every part’s audio in the final video is async.

    In some videos added with concat the video is not sped up, ie no -filter:v "setpts=0.1*PTS" and the audio is kept, ie no -an as in

    ffmpeg -y -ss 1 -t 2 -i "test3.mp4" -an -c:v libx264 test4.mp4
    ffmpeg -y -i test4.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts 4f.ts

    How do I mute the sped up parts and have audio not be async in the final video ?