0

After a lot of struggle I finally did what I want, i.e., save filters using ffmpeg now for now I'm using the Vintage filter command line from FFMPEG in order to add Vintage Filter to it. But there is a certain problem, and the problem is that The output is coming 90 degree clockwise rotated which is not what I wanted.

I've used this command from FFMPEG documentation, and the vintage filter application is working fine.

String complexCommand[] = {"-y", "-i", stringBuilder.toString(), "-strict", "experimental", "-vf", "curves=vintage",
            "-s", "640x480", "-r", "30", "-aspect", "4:3", "-ab",
            "48000","-ac", "2", "-ar", "22050", "-b:a", "2097k", "-vcodec", "mpeg4", savingPath};

I've read about how to do the rotation from this link : Video Rotation using FFMPEG

Now what I've tried is rotating the video 90 degree counterclockwise which transpose=2 after -vf from the documentation.

1.This is what I've done :

String complexCommand[] = {"-y", "-i", stringBuilder.toString(), "-strict", "experimental", "-vf", "transpose=2", "curves=vintage",
            "-s", "640x480", "-r", "30", "-aspect", "4:3", "-ab",
            "48000","-ac", "2", "-ar", "22050", "-b:a", "2097k", "-vcodec", "mpeg4", savingPath};

But I got this problem in my logcat, i.e.,

[NULL @ 0xaaab0c00] Unable to find a suitable output format for 'curves=vintage' curves=vintage: Invalid argument

2. I've also done this in order to get the desired result :

String complexCommand[] = {"-y", "-i", stringBuilder.toString(), "-strict", "experimental", "-vf", "transpose=2",
        "-s", "640x480", "-r", "30", "-aspect", "4:3", "-ab",
        "48000","-ac", "2", "-ar", "22050", "-b:a", "2097k", "-vcodec", "mpeg4", savingPath};

Now from above the result is fine, without any filter.

3. I've tried this also which was my last attempt to do that :

String complexCommand[] = {"-y", "-i", stringBuilder.toString(), "-strict", "experimental", "-vf", "curves=vintage", "-vf", "transpose=2",
        "-s", "640x480", "-r", "30", "-aspect", "4:3", "-ab",
        "48000","-ac", "2", "-ar", "22050", "-b:a", "2097k", "-vcodec", "mpeg4", savingPath};

Here is what I have changed : "-vf", "curves=vintage", "-vf","transpose=2"

But the result was same as in the second, only the rotated video, no fiters applied to the video.

I'm in need of the result as I've reached close to my destination but the problem is there and I need the result as the filtered video with the rotated form and that has to be implemented in the string only.

I think there is some issue with the string before -vf as the video is getting rotated before -vf and when I apply transpose then the correct result comes. Any suggestion would be appreciated.

EDITS

I've tried using this too, the && in between the command in order to get the result but I'm getting this error in my logcat :

E/MediaMetadataRetrieverJNI: getFrameAtTime: videoFrame is a NULL pointer

What I've done is :

String complexCommand[] = {"-y", "-i", stringBuilder.toString(), "-strict", "experimental", "-vf", "curves=vintage",
            "&&", "-vf", "transpose=2", "-s", "720x720", "-r", "30", "-aspect", "4:3", "-ab",
            "48000","-ac", "2", "-ar", "22050", "-b:v", "2097k", "-vcodec", "mpeg4", savingPath};
Alok
  • 8,452
  • 13
  • 55
  • 93
  • When re-encoding, `ffmpeg` will automatically rotate the video according to the rotate sidedata (unless you're using an ancient version). See [If you rotate the iPhone's video with ffmpeg, the rotation information sticks. Can I hide this?](https://stackoverflow.com/a/45853433/1109017). – llogan Aug 31 '17 at 17:08
  • This is to your notice that the landscape videos are not affected it is just the portrait videos which are getting converted into the landscape mode and saved. **Is there any way where I can retain the orientation even after the saving of the file using ffmpeg**. I've used the library from this website and built in my gradle. [link](http://writingminds.github.io/ffmpeg-android-java/) – Alok Sep 01 '17 at 07:48
  • Show the complete console/log output from your command using a portrait input and/or provide a short sample portraint input video. – llogan Sep 01 '17 at 16:35
  • @LordNeckbeard I'm providing you the portrait video in the following **video link**, use the above command line and do let me know what you get. [Video Link](https://drive.google.com/open?id=0B8fdRh5_PUJCajlKQ0M0elNOejQ) – Alok Sep 01 '17 at 18:25
  • This is not a portrait video, but a square video. It has no rotation side data as you can see with `ffprobe -show_streams -show_format input.mp4`. So using `transpose=2` on it will rotate it 90 degrees counterclockwise. – llogan Sep 01 '17 at 19:26
  • So why am I seeing the output in 90 degree clockwise rotated(portrait videos only) from in my video player every time when I get the output? – Alok Sep 01 '17 at 19:37
  • I'm guessing it is because you're rotating it with the transpose filter. – llogan Sep 01 '17 at 20:43
  • Nopes all I'm using the first one which I just mentioned in the first command line. Without any transpose filter. – Alok Sep 01 '17 at 20:50
  • I don't know. I can't duplicate the issue using the input video you provided. – llogan Sep 01 '17 at 22:11

0 Answers0