question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi

I was following this issue but I am still having issues merging 2 video files My code is as follows `@Test public void test() throws IOException { String introVideoFile=“C:\development\vid\final\tmpIntro_3.mp4”; String videoContentFile=“C:\development\vid\final\tmpContent_3.mp4”;

	VideoPropertiesVO videoPropertiesVO = new VideoPropertiesVO();
	videoPropertiesVO.setOutputVideoFileLocation("C:\\development\\vid\\final\\output.mp4");
	boolean concatResult = concatVideos(videoPropertiesVO, introVideoFile, videoContentFile);
	System.out.println("concatResult:" + concatResult);
}


private static boolean concatVideos(VideoPropertiesVO videoPropertiesVO, String introVideoFile, String videoContentFile)
		throws IOException {
	System.out.println("introVideoFile:" + introVideoFile);
	System.out.println("videoContentFile:" + videoContentFile);

	FFmpeg ffmpeg = new FFmpeg(Constants.FFMPEG_EXE_PATH);;
	FFprobe ffprobe= new FFprobe(Constants.FFPROBE_EXE_PATH);	
	
	Path listOfFiles = null;
	try {
		Path intro = Paths.get(introVideoFile);
		Path content = Paths.get(videoContentFile);

		Path[] files = new Path[2];
		files[0] = intro;
		files[1] = content;

		String filesStrings = List(files).map(f -> f.toAbsolutePath().toString()).map(p -> "file '" + p + "'")
				.mkString(System.getProperty("line.separator"));

		listOfFiles = Files.createTempFile(intro.getParent(), "ffmpeg-list-", ".txt");
		Files.write(listOfFiles, filesStrings.getBytes());

		FFmpegBuilder builder = new FFmpegBuilder()
				.setInput(listOfFiles.toAbsolutePath().toString())
				.setFormat(FORMAT_CONCAT).addExtraArgs("-safe")
				.addOutput(videoPropertiesVO.getOutputVideoFileLocation())
				.setAudioCodec(CODEC_COPY)
				.setVideoCodec(CODEC_COPY).done();
		builder.setVerbosity(Verbosity.DEBUG);

		FFmpegExecutor fFmpegExecutor = new FFmpegExecutor(ffmpeg, ffprobe);

		fFmpegExecutor.createJob(builder).run();

	} catch (IOException e) {
		System.out.println("Error during Ffmpeg conversion: Exception:" + e);
	} finally {
		Path finalListOfFiles = listOfFiles;
		if (nonNull(listOfFiles)) {
			Try(() -> Files.deleteIfExists(finalListOfFiles));
		}
	}
	return true;
}`

I can verify that all files do exist. The output I get is as follows introVideoFile:C:\development\vid\final\tmpIntro_3.mp4 videoContentFile:C:\development\vid\final\tmpContent_3.mp4 ffmpeg version N-89343-g83ecdc9a92 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 7.2.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx libavutil 56. 4.100 / 56. 4.100 libavcodec 58. 6.102 / 58. 6.102 libavformat 58. 2.103 / 58. 2.103 libavdevice 58. 0.100 / 58. 0.100 libavfilter 7. 5.100 / 7. 5.100 libswscale 5. 0.101 / 5. 0.101 libswresample 3. 0.101 / 3. 0.101 libpostproc 55. 0.100 / 55. 0.100 Splitting the commandline. Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'. Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'. Reading option '-f' ... matched as option 'f' (force format) with argument 'concat'. Reading option '-safe' ... matched as AVOption 'safe' with argument '-i'. Reading option 'C:\development\vid\final\ffmpeg-list-8634572609066384284.txt' ... matched as output url. Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'copy'. Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'copy'. Reading option 'C:\development\vid\final\output.mp4' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option y (overwrite output files) with argument 1. Applying option v (set logging level) with argument debug. Successfully parsed a group of options. Parsing a group of options: output url C:\development\vid\final\ffmpeg-list-8634572609066384284.txt. Applying option f (force format) with argument concat. Successfully parsed a group of options. Opening an output file: C:\development\vid\final\ffmpeg-list-8634572609066384284.txt. [NULL @ 000002164fc2ab60] Requested output format 'concat' is not a suitable output format C:\development\vid\final\ffmpeg-list-8634572609066384284.txt: Invalid argument

The main error is [NULL @ 000002164fc2ab60] Requested output format ‘concat’ is not a suitable output format

Could someone please help to validate what may be the issue here?

Thank you Damien

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
HadesDXcommented, Sep 3, 2018

I got it working! using .addExtraArgs(“-safe”, “0”)

0reactions
clicitcommented, Nov 25, 2019

Same problem here, anyone got this working? @HadesDX maybe? When I start ffmpeg manually from the command with exactly the same parameters, there is no problem.

Thanks!

I got it working now: I was using relative paths in the TXT file. Using absolute paths there solved the problem!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Merge Videos Online — Combine Video Clips - Clideo
Online Video Combiner is aimed at merging different clips into a single piece. It allows adding audio and works with all common video...
Read more >
Merge Videos: Free Online Video Merger | Adobe Express
The Adobe Express video merger tool is fast, free, and easy to use. Simply upload your clips, arrange them as needed, and instantly...
Read more >
Merge Videos Online - Combine Videos & Clips for Free
This powerful free video editing platform lets you merge videos online, edit them how you want, and produce a professionally-looking video with ease....
Read more >
Merge Videos Online - Free Video Joiner - VEED.IO
You can merge, join & combine your video, audio and image files online, free, with VEED. Whether you're working on windows, mac, or...
Read more >
Merge Video, video joiner to combine multiple video files
This video merger can merge video files and concatenate various video clips, such as MP4, AVI, FLV, MOV, 3GP, MKV, WMV and more,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found