0

I want to have the output file to have same name from source ( for eg first filename from list.txt), how can I do it?

This is the code I have which converts the all the .avi in folder to a single files and renames it to output.avi.

Instead of output.avi I want the filename to be same as first filename from source folder or first filename from list.txt.

for %%f in (*.avi) do (
    echo file %%f >> list.txt
)
ffmpeg -f concat -safe 0 -i list.txt -c copy output.avi
del list.txt

One more thing I want to know, is it possible to flip video horizontal or mirror it without re-encoding?

llogan
  • 121,796
  • 28
  • 232
  • 243
Jermy
  • 1
  • 2
  • You should only ask one question per post. Multi question posts tend to get ignored or get partial answers which often don't get accepted. – llogan May 21 '19 at 17:20

2 Answers2

1

I don't think ffmpeg supports "backreferencing" the input filenames. I suggest handling that in bash or some through other means of scripting. E.g. you can use the first line of list.txt as the output filename like this (untested):

ffmpeg -f concat -i list.txt -c copy output/$(head -1 list.txt)

In this example if the first line is foo.avi, the output will be saved at output/foo.avi.

is it possible to flip video horizontal or mirror it without re-encoding

Apparently you can set rotation metadata without re-encoding to hint video players to play it back with the given rotation. Maybe there are metadata flags for mirroring or flipping, but I couldn't find any.

If this does not work for you, I don't believe there is a built-in solution to do this without re-encoding.

Felk
  • 7,720
  • 2
  • 35
  • 65
1

Is it possible to flip video horizontal or mirror it without re-encoding?

No, not when using filters (such as hflip, vflip, rotate, etc). Filtering requires re-encoding.

Rotation metadata as mentioned in another answer may suffice this use case, but support among players is not universal. There is no metadata for mirroring or flipping: only rotation.

If that is not acceptable then the player itself may have mirroring/flipping capabilities. Example:

mpv -vf hflip video.mp4
llogan
  • 121,796
  • 28
  • 232
  • 243