With the format of webm that's needed for 360video, please post any good program that converts from mp4 to webm and your assessment of the output quality if possible.
mp4 to webm converter?
-
-
ffmpeg of course!
-
PanoVideo Converter (free) It's based on ffmpeg. But no scripting. Simply make settings. It's produce .mp4 .webm .ogv from any source file in any combination.
Or better - PanoVideo Creator. based on converter. It's also make posters, tour.xml, preview navigation and so on. -
Hi Klaus,
ffmpeg is great for the job but I'm getting lost in the commandline settings!
In the Pano Video Converter, on clicking convert, a command line window opens but closes immediately and nothing happens. I tried with all the possible settings.
Could kindly share the line to use to convert an mp4 1920x960 to 2 webm files one same size and second 1024x512 as you use in the panovideo examples?
-
Hi Islander!
ffmpeg script generally will look like this:
ffmpeg: input.mp4 output.webm
But it is only the start of troubles. Because:
1. you need to work with command line
2. you need to write input and output path
3. you need to prepare separatly each webm and mp4 files in different qualities
4. additionally you need in posters - 2 qualities
5.Perhaps you want to prepare audio for iphone
6. No batch files. You need to prepare all sets of files for each video. It means repeat operations for each file
Panovideo converter is free program and it takes care to do all this operations and provides you with wysiwyg interface. -
Are you really gonna advertise in every post about that panovideo converter?
This is a forum not folder!
Please!!Tuur
-
I'm try to help. And I'm didn't write anything that exceed the theme.
Thank. -
In the Pano Video Converter, on clicking convert, a command line window opens but closes immediately and nothing happens. I tried with all the possible settings.
Hi Islander!
as you have edited your post I can write you additional information This information from TourCreator may be useful for you, as well as for others.Don't try to convert video from krpano examples version 1.19.4 and higher. This file is protect from convertation.
Of course we can remove protect information. But among other it will
mean that anyone can download any video from net and create his own
panovideo tour. We think that it is not the good approach.So, try convert your own video or find on your computer archive file from version 1.18.5 or earlier and try it.
This video (part 2) demonstrate how you can convert video files with PanoVideo Converter.
-
Hi Denis,
I appreciate your help.
I've freezed a video capture of the error appearing in the blink of a eye.
As you notice the error reads: no such file or directory. I think it has nothing to do with the file being locked. It's not the sample video; it's an equirectangular video that I could even upload as vr360 to youtube.I would really like to use the PanoVideo Converter for its simplicity. Anyone experiencing this is welcome for comments.
-
VLC for anyone on a Mac will work. In VLC go to File>Convert/Stream
-
I've freezed a video capture of the error appearing in the blink of a eye.
Hi Islander!
Great job. Not easy to get this picture.
You are the first who report about troubles in converting formats with ffmpeg.
There are few variants for this. Either file protected or it is corrupted.
Please, give me your file. I can see what wrong with it.
Best regards. -
Hi Denis,
Here's a short video clip mp4: https://www.dropbox.com/s/o8ve203cp93b…20clip.mp4?dl=0
Click Here -
Hi Islander!
Thank you for help. There are was two problems:
1. incorrect file name (white space between words)
2. problem with audio converting (there are empty audio channel in your file with strange format)
Now this bugs are fixed.
You can download the new version of program from our site. http://www.tcreator.classic-ru.org/programs/videoconverter/If somebody else have problems with file conversion, please, feel free to write us. We can help. It's better to do in the thread with PanoVideo Converter http://www.krpano.com/forum/wbb/index.php?page=Thread&postID=66729#post66729</a>
-
As for me, Joyoshare Video Converter is dencent. It is esay to use. I prefer some programs that are not very complicated since I am a beginner.
-
This might be a bit over-kill but here is the code we use to convert our mp4's into several versions for deployment. Not exactly what you want but it might have something useful in it. This is Python used in a Lambda deployment system, pulling media fam an S3 bucket.
Code
Display Moreimport osimport stat import shutil import sys import boto3 import logging logger = logging.getLogger() logger.setLevel(logging.INFO) # clean out /tmp folder = '/tmp' for the_file in os.listdir(folder): file_path = os.path.join(folder, the_file) try: if os.path.isfile(file_path): os.unlink(file_path) elif os.path.isdir(file_path): shutil.rmtree(file_path) except Exception as e: logger.info("cleanup /tmp exception: " + e) print(e) lambda_tmp_dir = '/tmp' # Lambda fuction can use this directory. # ffmpeg loading ffmpeg = "{0}/ffmpeg".format(lambda_tmp_dir) shutil.copyfile('/var/task/ffmpeg', ffmpeg) os.environ['ffmpeg'] = ffmpeg os.chmod(ffmpeg, os.stat(ffmpeg).st_mode | stat.S_IRWXU) os.chmod("/tmp", stat.S_IRWXU) s3 = boto3.client('s3') # Make sure the target directory exists def prepare_path(target): if os.path.exists(target): logger.info("{0} exists".format(target)) shutil.rmtree(target) os.mkdir(target) # Copy/download the file to local # standard way of doing things """ def copy_object(bucket, source, dest): name = source.split('/')[-1] local_file = "{0}/{1}".format(dest, name) logger.debug("{0} to {1}".format(source, local_file)) s3.download_file(bucket, source, local_file) if os.path.exists(local_file): b = open(local_file, "r") return local_file """ # The following function can be used to upload directory to s3 via boto. def upload_files(path, bucket, mediaId, fileType): logger.info("upload_files() path-> " + path + " | bucket-> " + bucket + " | mediaId-> " + mediaId + " | fileType-> " + fileType) for subdir, dirs, files in os.walk(path): for file in files: full_path = os.path.join(subdir, file) with open(full_path, 'rb') as data: thisKey = 'media/' + fileType + '/' + mediaId + '/' + full_path[len(path) + 1:] logger.info("upload_files() thisKey-> " + thisKey) s3.put_object(Bucket=bucket, Key=thisKey, Body=data) def create_presigned_url(bucket_name, object_name, expiration=3600): """Generate a presigned URL to share an S3 object :param bucket_name: string :param object_name: string :param expiration: Time in seconds for the presigned URL to remain valid :return: Presigned URL as string. If error, returns None. """ # Generate a presigned URL for the S3 object s3_client = boto3.client('s3') try: response = s3_client.generate_presigned_url('get_object', Params={'Bucket': bucket_name, 'Key': object_name}, ExpiresIn=expiration) except ClientError as e: logging.error(e) return None # The response contains the presigned URL return response def ffmpeg_lambda_handler(event, context): # determine the ID the_file_path = event['Records'][0]['s3']['object']['key'] the_bucket = event['Records'][0]['s3']['bucket']['name'] the_file_path_array = the_file_path.split('/') the_file_name = the_file_path_array[-1] the_file_name_array = the_file_name.split('.') mediaId = str(the_file_name_array[0]) fileType = the_file_path_array[1] # create the local_path local_path = "{0}/{1}".format(lambda_tmp_dir, mediaId) prepare_path(local_path) # copy_object to destination path. # localInputFile = copy_object(the_bucket, the_file_path, local_path) localInputFile = create_presigned_url(the_bucket, the_file_path, expiration=3600) # ++++++++++++++++++++++++++++++++++++++++ FFMPEG ++++++++++++++++++++++++++++++++++++++++++ audioPath = "{0}/{1}".format(local_path, 'audio_file.mp3') if fileType == 'transition': # GoPro settings brPairs = [[1080, 16000], [1080, 7000], [720, 3000], [540, 1500], [224, 440]] else: # Spherical Video settings brPairs = [[1920, 16000], [720, 3000], [960, 7000], [1440, 16000], [2048, 40000]] for p in brPairs: # size thisKey = str(p[0]) # get bit-rate bitrate = p[1] # buffer rate bufs = str(bitrate * 0.75) # convert num to string bitstring = str(bitrate) # final file path final_file = thisKey + '_' + bitstring + '.mp4' localOutputPath = "{0}/{1}".format(local_path, final_file) localOutputPath = str(localOutputPath) s3Path = 's3://xplorit-media/processor/360video/170968.mp4' httpsPath = 'https://s3-us-west-2.amazonaws.com/xplorit-media/processor/360video/170968.mp4' buff_temp_name = str('temp_' + mediaId + '_' + thisKey + '_' + bitstring) localTempPath = "{0}/{1}".format(local_path, buff_temp_name) localTempPath = str(localTempPath) myPassLogFile = folder + '/my_passlog_' + mediaId + '_' + thisKey + '_' + bitstring # Pass Commands # pass_one_command = ffmpeg + ' -y -i ' + localInputFile + ' -c:v libx264 -strict -2 -b:v ' + bitstring + 'k -maxrate ' + bitstring + 'k -bufsize ' + bufs + 'k -vf scale=-2:' + thisKey + ' -an -pass 1 -passlogfile ' + myPassLogFile + ' -f mp4 ' + localTempPath # pass_two_command = ffmpeg + ' -y -i ' + localInputFile + ' -c:v libx264 -strict -2 -b:v ' + bitstring + 'k -maxrate ' + bitstring + 'k -bufsize ' + bufs + 'k -vf scale=-2:' + thisKey + ' -c:a aac -b:a 128k -pass 2 -passlogfile ' + myPassLogFile + ' -movflags +faststart -f mp4 ' + localOutputPath pass_one_command = ffmpeg + ' -y -i "' + localInputFile + '" -c:v libx264 -strict -2 -b:v ' + bitstring + 'k -maxrate ' + bitstring + 'k -bufsize ' + bufs + 'k -vf scale=-2:' + thisKey + ' -an -pass 1 -passlogfile ' + myPassLogFile + ' -f mp4 /dev/null' pass_two_command = ffmpeg + ' -y -i "' + localInputFile + '" -c:v libx264 -strict -2 -b:v ' + bitstring + 'k -maxrate ' + bitstring + 'k -bufsize ' + bufs + 'k -vf scale=-2:' + thisKey + ' -c:a aac -b:a 128k -pass 2 -passlogfile ' + myPassLogFile + ' -movflags +faststart -f mp4 ' + localOutputPath # aws s3 cp - s3: // my - amazing - bucket / geoip_v4_data.csv.gz # ffmpeg - re - i in.ts - f hls - method PUT http: // example.com / live / out.m3u8 # Pass one logger.info("Pass One " + pass_one_command) os.system(pass_one_command) # Pass two logger.info("Pass two " + pass_two_command) os.system(pass_two_command) # delete temp os.system('rm -f ' + localTempPath) # delete log os.system('rm -f ' + myPassLogFile) # delete mbtree os.system('rm -f ' + myPassLogFile + '-0.log.mbtree') logger.info("B -> DONE PROCESSING = " + mediaId + '_' + thisKey + '_' + bitstring) # upload file localOutputPath key_create = 'media/' + fileType + '/' + mediaId + '/' + final_file logger.info("UPLOADING localOutputPath = " + localOutputPath + ' the_bucket = ' + the_bucket + ' key_create = ' + key_create) s3.upload_file(localOutputPath, the_bucket, key_create) # remove file os.system('rm -f ' + localOutputPath) # encode audio audioCommand = ffmpeg + ' -y -i "' + localInputFile + '" -f mp3 -ab 192000 -vn ' + audioPath logger.info("Audio extraction " + audioCommand) try: os.system(audioCommand) key_create = 'media/' + fileType + '/' + mediaId + '/audio_file.mp3' logger.info("UPLOADING audioPath = " + audioPath + ' the_bucket = ' + the_bucket + ' key_create = ' + key_create) s3.upload_file(audioPath, the_bucket, key_create) logger.info("Audio extraction SUCCESS " + audioCommand) except: logger.info("Audio extraction ERROR" + audioCommand) # upload audio file localOutputPath # ++++++++++++++++++++++++++++++++++++++++ KRPANOTOOLS ++++++++++++++++++++++++++++++++++++++++++ # Upload to s3. # upload_files(local_path, the_bucket, mediaId, fileType) # key_create = 'media/' + fileType + '/' + mediaId + '/' + mediaId + '.mp4' # logger.info("UPLOADING localInputFile = " + localInputFile + ' the_bucket = ' + the_bucket + ' key_create = ' + key_create) # s3.upload_file(localInputFile, the_bucket, key_create) logger.info("OK WE'RE DONE!!!")
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!