Create a video from jpeg with avconv => corrupted video - image

Im trying to make a video (whatever the format) from a directory full of jpeg frames.
I tried with avconv (v0.8), as seen on many topics on the internet, and the libav documentation as well :
avconv -i samples/*.jpeg output.mpeg
It seems to work nicely and create the output.mpeg file.
But the file can't be read by any reader (vlc, banshee, totem,...). No error, but nothing happend when I press Play.
If I check the video file size, it is about 20kB, whereas the original video is 10MB. So we can assume the data has not been stored into the file (it is about 20kB no matter the number of frames given on input)
I made a pastebin of the debug log of the processing. I am not familiar with codec world, so I don't understand many things : http://pastebin.com/9dfxFWZe.
I also try a lot of combinations with -s, -r, -b, -vcodec, -f format, etc.. but the probleme is still there.
Am I doing anything wrong ?
Ask me anything that could help you, I will answer very quickly.
Thank you for your help :)

avconv expects you to give the input filenames in a printf-like syntax. Simply using shell wildcards (such as samles/*.jpeg) is not enough.
Your samples seem to be named sample/lapinsnipermin/.jpeg, so try the following command line:
avconv -f image2 -i samples/lapinsnipermin/%03d.jpeg output.mpeg
Does this work? You might also want to add options for the bitrate (e.g -r 25).

Resurrecting this since it came up when Googling for a solution. I finally got it working using this:
knoppix#Microknoppix:~$ avconv -r 1 -i /tmp/photo%d.jpg -r 24 -s 320x240 -vsync cfr /tmp/video.mpg
I couldn't get avconv to recognize the input files in the original names; this shows why:
knoppix#Microknoppix:~$ strace avconv -i /media/sdb1/DCIM/188_0408/IMGP%04d.JPG /tmp/video.mpg 2>&1 | grep 188_0408
execve("/usr/bin/avconv", ["avconv", "-i", "/media/sdb1/DCIM/188_0408/IMGP%0"..., "/tmp/video.mpg"], [/* 36 vars */]) = 0
stat64("/media/sdb1/DCIM/188_0408/IMGP0000.JPG", 0xbf925b00) = -1 ENOENT (No such file or directory)
stat64("/media/sdb1/DCIM/188_0408/IMGP0001.JPG", 0xbf925b00) = -1 ENOENT (No such file or directory)
stat64("/media/sdb1/DCIM/188_0408/IMGP0002.JPG", 0xbf925b00) = -1 ENOENT (No such file or directory)
stat64("/media/sdb1/DCIM/188_0408/IMGP0003.JPG", 0xbf925b00) = -1 ENOENT (No such file or directory)
stat64("/media/sdb1/DCIM/188_0408/IMGP0004.JPG", 0xbf925b00) = -1 ENOENT (No such file or directory)
write(2, "/media/sdb1/DCIM/188_0408/IMGP%0"..., 66/media/sdb1/DCIM/188_0408/IMGP%04d.JPG: No such file or directory
I didn't see an option for setting the starting number, so I did this:
i=0; for file in /media/sdb1/DCIM/188_0408/IMGP28*.JPG; do cp $file /tmp/photo$i.jpg; i=$((i+1)); done
The end result is a video of my photos, showing one for each second; the -vsync cfr tells avconv to pad the input frames to match the output framerate.

I found it better to pipe the jpg file in you want so you can control the selection with standard wildcards, try something like this. This also outputs a video that you can user on the web and mobile (ie. using the standard browser tag):
cat samples/*.jpeg | avconv -r 30 -f image2pipe -codec:v mjpeg -i - -pix_fmt yuvj420p -r 30 -c:v libx264 -vf scale=480:300 -y output.mp4

Related

ffmpeg segment command flac output broken 'length' metadata

I am trying to use this ffmpeg command:
ffmpeg -i "full_lowq.flac" -c copy -map 0 -f segment -segment_times "302.825,552.017" "%03d_output.flac"
to take my flac file input "full_lowq.flac" and split it at specific points 302.825,552.017 into output audio files like so:
%01d_output.flac
%02d_output.flac
%03d_output.flac
And this command does work at the moment, except that my three outputted flac files display the wrong 'length' metadata number when viewed in the win10 file browser. like in this example every outputted file has the same length as 11:16
But if i view the audio files in audacity i can see the correct file length such as file 0 have a length of 05:02
Is it possible my input file (https://file.io/oof3eykKwXiI) is corrupted? or my command is making a mistake here? wrong codec?

How to merge .ts files from a DLINK security camera losslessly?

I have >1000s of small .ts files from a DLINK camera of a theft that occured. I first tried to merge the ts files into bigger files so that I could look for the audio where the relevant event occurred. Then in Premiere I looked for the highest sustained audio peaks (it was someone using a saw to cut out a catalytic converter). Then, I isolated the relevant 200 files where things happened on the timeline. But now, I want to export the 20 minutes of the incident with the least compression (or no compression). Apparently Adobe Premiere can export the whole timeline containing these clips, but will compress them. I have not edited any of the files, so I don't want any rendering. I just want them strung together in a "well-known" format so I can send the files to the insurance company and authorities.
I used an answer from here but there were audio gaps. Some of the files had no audio, causing the problem when I first merged the files with:
for i in `\ls *.ts | sort -V`; do echo "file '$i'"; done >> mylist.txt;ffmpeg -f concat -i mylist.txt -c copy -bsf:a aac_adtstoasc video.mp4
This worked for me, and I'm sending it along to help the investigation.
xargs cat <mylist.txt >>catout.ts
ffmpeg -i catout.ts -map 0 -c copy catout.mp4
I had >200 .ts files from a DLINK security camera I needed to stitch up losslessly for the authorities (insurance).
After looking around on Stackoverflow, here's what I did.
First create a list of the ts files to combine:
for i in `\ls *.ts | sort -V`; do echo "file '$i'"; done >> mylist.txt;
Merge them into one ts:
ffmpeg -f concat -safe "0" -i mylist.txt -c copy merge.ts
Then convert the ts directly and losslessly to a well known format for the authorities
ffmpeg -i merge.ts -map 0 -c copy output.mp4

Creating timelapse video with ffmpeg using list of URL images from .txt file [duplicate]

I'm attempting to concatenate various .ts video clips into one video and then convert the video into an .mp4 file. I know I can make a .txt file formatted like so:
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
and then concatenate them like so:
ffmpeg -f concat -i mylist.txt -c copy all.ts
and then convert the file like so:
ffmpeg -i all.ts -acodec copy -vcodec copy all.mp4
My question is, can my .txt file be urls from another domain? e.g.:
http://somewebsite.com/files/videoclip1.ts
http://somewebsite.com/files/videoclip2.ts
http://somewebsite.com/files/videoclip3.ts
Or, do I first have to download all these clips, store them locally on my domain, then make a .txt file pointing to them? I'm using PHP. Thanks.
Yes, this is possible. Note that in the following examples I use the urls and filenames from your question, when testing I used some test files on my own web server.
Trying this with the example text file you provided will give a pretty clear error message:
[concat # 0x7f892f800000] Line 1: unknown keyword 'http://somewebsite.com/files/videoclip1.ts
mylist.txt: Invalid data found when processing input
This is easily fixed by re-introducing the 'file' keyword in mylist.txt:
file 'http://somewebsite.com/files/videoclip1.ts'
file 'http://somewebsite.com/files/videoclip2.ts'
file 'http://somewebsite.com/files/videoclip3.ts'
That updated file will give a different error message:
[concat # 0x7fa467800000] Unsafe file name 'http://somewebsite.com/files/videoclip1.ts'
mylist.txt: Operation not permitted
The reason for this is that ffmpeg will not allow http-urls by default. This can be bypassed by including the -safe 0 argument in your ffmpeg call before the -i argument:
ffmpeg -f concat -safe 0 -i mylist.txt -c copy all.ts
This might work out of the box on your installation, on mine this gave another error message:
[http # 0x7faa68507940] Protocol 'http' not on whitelist 'file,crypto'!
[concat # 0x7faa69001200] Impossible to open 'http://somewebsite.com/files/videoclip1.ts'
mylist.txt: Invalid argument
This is because, on my installation, ffmpeg's default protocol whitelist only includes file and crypto. To allow the http protocol as well, we need to explicitly provide the allowed protocols whitelist in the command. As it turns out, tcp is also required:
ffmpeg -f concat -safe 0 -protocol_whitelist file,http,tcp -i mylist.txt -c copy all.ts
This allowed my installation to download and concatenate the video files.

ffmpeg convert images with name pattern into video [duplicate]

I am trying to make an FFMPEG script that relied on a glob input pattern from Linux to Windows. Unfortunately that is not supported so I am looking for an alternative. I do not want to have to rename or copy the files every time I run the script because the files are used elsewhere and I cannot rename them and I would like to avoid duplication or unnecessary temporary files.
Are globs numerically sequential named images my only option here? Ideally I would like to input a list of image paths to FFMPEG as a substitute for ffmpeg -i *.jpg
The workarounds are to prepare a text file with the names and use the concat demuxer.
Or you can use image2pipe
cat *.jpg | ffmpeg -f image2pipe -framerate 25 -i - out.mp4
The best solution I could find (that's Windows compatible) was to generate a line separated list of files in a text file and pass that through to FFMPEG. For example, to generate a stabilized MP4 from a bunch of JPEGs:
ffmpeg -f concat -safe 0 -i ./files.txt -vf deshake=rx=64:ry=64 ./stabilized.mp4
Where files.txt is a list of the files in the following format. The safe option toggles the ability to have absolute/relative file paths.
# this is a comment
file 'C:/path/to/file1.jpg'
file 'C:/path/to/file2.jpg'
file 'C:/path/to/file3.jpg'

Input parameters to FFMPEG

I am trying to make an FFMPEG script that relied on a glob input pattern from Linux to Windows. Unfortunately that is not supported so I am looking for an alternative. I do not want to have to rename or copy the files every time I run the script because the files are used elsewhere and I cannot rename them and I would like to avoid duplication or unnecessary temporary files.
Are globs numerically sequential named images my only option here? Ideally I would like to input a list of image paths to FFMPEG as a substitute for ffmpeg -i *.jpg
The workarounds are to prepare a text file with the names and use the concat demuxer.
Or you can use image2pipe
cat *.jpg | ffmpeg -f image2pipe -framerate 25 -i - out.mp4
The best solution I could find (that's Windows compatible) was to generate a line separated list of files in a text file and pass that through to FFMPEG. For example, to generate a stabilized MP4 from a bunch of JPEGs:
ffmpeg -f concat -safe 0 -i ./files.txt -vf deshake=rx=64:ry=64 ./stabilized.mp4
Where files.txt is a list of the files in the following format. The safe option toggles the ability to have absolute/relative file paths.
# this is a comment
file 'C:/path/to/file1.jpg'
file 'C:/path/to/file2.jpg'
file 'C:/path/to/file3.jpg'

Resources